Remote Backup Database and Directories

Here are some nifty commands to backup a directory:

ssh user@host "tar zcf - /the/dir/" > filename.tgz

And then to backup a database

ssh user@host "mysqldump -u user -ppass --all-databases | gzip -c" > filename_db.gz

Comments