Compress a folder and send it to another server via SSH

This command will tar an entire folder, pass it to gzip then pass it to SSH which then in turn writes the resultant output to a file on a remote server Useful for backing up small folders to remote servers Don't forget to ssh-copy-id on the source server so password-less authentications works

1tar -cvf - /var/log/httpd/ | /bin/gzip -c | /usr/bin/ssh root@1.1.1.1 'cat > /root/test.tar.gz'