It’s 2017 and when two devs sitting next to each other are confronted with the task of transferring a giant bulky file from one laptop to another, the stress in the room rips. Why is this so hard? I found myself in this situation recently when my coworker suggested we try netcat. With full skepticism on how an ancient unix tool can possibly be an acceptable answer with all the airdropping, cloud syncing, and transfer-a-file-as-a-service options out there, I agreed to give it a shot.
It worked great.
How to Netcat a File to Your Coworker
# macOS $ nc -l 1234 > myfile # Anything else, or brew installed netcat $ nc -l -p 1234 > myfile
Also, you’ll want your IP
# macOS $ ifconfig en0 inet en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 inet 192.168.0.28 netmask 0xffffff00 broadcast 192.168.0.255
Trigger the transfer
$ cat myfile | nc 192.168.0.28 1234
See it in action
Here I’ll transfer my plans for a taco truck to my coworker Frank.
Bam. Taco plans delivered. And now I’m getting hungry.