Re:A Unix Utility You Should Know About: Pipe Viewer
by pwk on Monday February 02, 2009 @12:20PM
(#462539)
Oh, and of course netcat (nc). Indispensable for debugging anything TCP/IP based.
Of course there are more specific tools for specific protocols, like curl or wget for http, but nc is the swiss army knife.
[ Parent
| on HN ]
Re:A Unix Utility You Should Know About: Pipe Viewer
by yan on Monday February 02, 2009 @05:12PM
(#462992)
nc is also awesome for quick and dirty file/directory transfer over the wire:
host1 (receiving): nc -l 6123 > tar xfz -
host2 (sending ): tar cfz - directory/ | nc host2 6123
Re:A Unix Utility You Should Know About: Pipe Viewer
by alnayyir on Wednesday February 04, 2009 @12:54AM
(#465309)
you know, it's cool that you do that (quite neat in fact), but why is this better than scp'ing something, pray tell?
Re:A Unix Utility You Should Know About: Pipe Viewer
by meredydd on Wednesday February 04, 2009 @05:40AM
(#465563)
My favourite two reasons for using it:
1. I often tend to use it when I want to pipe the output into a command. If it's a big transfer, I don't really want to have to stream several gigabytes of data onto disk, then off it, then back on again. Restoring a database dump is one example:
me@host1$ nc -l -p <port> < db_dump.sql
postgres@host2$ nc <host> <port> | psql db-name
2. The other big advantage over scp is that sometimes, your target (deliberately) isn't accessible directly from an SSH login.In the example above, I want to process that data as the 'postgres' user, but there's no way I'm allowing direct logins as that user. 'root' is, of course, the other common example.
Re:A Unix Utility You Should Know About: Pipe Viewer
by yan on Wednesday February 04, 2009 @08:49AM
(#465711)
Firstly, if the two machines are on the same switch this method is noticeably faster than scp'ing something large. The actual main reason though, is that this isn't limited to tarring over a network. What it comes down to, is you can almost seamlessly have a shell pipeline and one of those stages jumps a machine boundary.