Piping data over SSH

Date June 6, 2006 by Isaac

It is sometimes useful to pipe binary data over a ssh connection. I use this sometimes when I want to back up the data on a machine over the network without creating a backup file first.
 
tar -cf - dir_to_backup | ssh user@hostname ‘cat > backup.tar’