2 ms·
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
by meredydd 18y ago
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.