ssh cheatsheat

Port forwarding

from http://www.openssh.com/faq.html#2.11

$ ssh -f -L 1234:server.example.com:6667 server.example.com sleep 10

Backing up files over SSH

$ ssh remote_host "tar -zc -C /path/to/parent/directory -f - some_directory" | cat > some_directory-`datestr`.tar.gz

Backing up a postgres database over SSH

$ ssh remote_host "pg_dump --username=db_user db_name" | gzip  > db_name-`datestr`.sql.gz