Welcome

netcat tricks

I have always liked netcat, but I never really use it at work. But I always feel like I should. Here is a wonderful list of things you may be able to use netcat for:

useful-netcat-tricks

Looking at the comments of that blog I saw another cool thing to do involving network transfer of files. It introduces a utility I didn’t know about before called lzop. It goes something like this:

On the sending computer…

dd if=/home/me/my_file | lzop | nc 192.168.0.1 9000

On the receiving computer…

nc -l -p 9000 | lzop -d |dd of=/someplace/my_file

So, the sending computer uses dd to pipe the file to lzop (which compresses it) then pipes it to netcat. The receiving computer gets the file via netcat, pipes it to “lzop -d” to decompress it, and finally dd gets it and writes it to disk. With lzop providing compression the transfer should go pretty quick. If the file compresses easily. Lzop is preferred in this case because it is supposed to much quicker than gzip, so it doesn’t get in the way while doing its thing.

A potential downside to sending huge files is that you have no progress meter. I suppose you can do a ls from time to time to judge when the file transfer will be done.

I have not tried any of this yet…

Actions: Trackback URL for this entry Commentfeed

Leave a comment

You must be logged in to post a comment.