Here is the fancy command which creates backup of a local directory in a remote SSH host. The output of “tar” command at localhost is redirected to “tar” command at remote host for extraction. The best thing is it is all done with a single command. You can create an alias for such command if you think it is time consuming to type all that for easy usage.

With this command, I am storing backup of a directory named “myproject” in a remote host liz.techpulp.com in “/backup/” directory. After execution of this command, there will be a directory named “/backup/myproject” in the remote host liz.techpulp.com.

[neo@techpulp ~]# ( tar -c myproject/ ) | ssh -C neo@liz.techpulp.com 'cd /backup/ && tar -x -p'
Password:
[neo@techpulp ~]#