This is something we do pretty much every week so I felt it was worth mentioning here.
It is possible with this simple command to move files from one *nix server to another. "But surely that is just SCP" I hear you say? Well it is, but because of the fact we can "pipe" multiple commands together in Linux, we can also compress these files via tar before we send them (meaning a much faster transfer speed).
The command in question is as follows:
# tar czf - /path/to/send/folder | ssh firstname.lastname@example.org "cd /path/to/recieve/folder; tar xvzf -"
- The command up to the pipe ("|") is to compress all the files in the given folder.
- After the pipe we then ssh to our destination server.
- Finally, we specify a command to execute on connection, which will CD to the destination location and extract our files.
Thats it, transfer away!