I cannot help but do a disservice to netcat here, no matter what I write today.
That’s because netcat is so simple, so flexible and so powerful that I could hardly encompass it all here. And like some other tools I’ve run across, there’s more out there across the vast wasteland of the Internet than I could list here.
All the same, there are a few nifty tricks I’ll repeat, just because they strike me as very cool. And it helps me remember them. 😉
For example, a simple file transfer between machines, no networking for file system tools needed: On one machine:
cat test.txt | nc -l -p 1228
And on the other:
nc (host) 1228 > test.txt
It’s almost as easy as ncp.
Here’s another, I remember using a long time ago: an impromptu remote shell, if ssh isn’t handy. On the controlling end:
nc -l -p 1228 -e /bin/bash
nc (host) 1228
Security-wise I don’t think that compares to ssh, but it might let you get the job done.
Those are the only two that I know of, and I learned them years ago, probably from this ancient how-to.
There are lots more out there though. netcat does some amazing things, and even when there are tools dedicated to a certain task, netcat can sometimes double for them. Check it out.
Edit, 2014-02-03, 06:30 a.m.: As luck would have it, I found this only a short while after posting. See, I told you there was a lot more you could do with it! 😉