How can I backup a directory or my website via SSH?

To backup complete site files, login via ssh.

While in you are in main dir type:

tar -zcf site_backup.tar.gz public_html

This will create a file named site_backup.tar.gz in your main dir.

To restore this file as a site type:

gunzip site_backup.tar.gz

hit enter, then type:

tar -xvf site_backup.tar

hit enter and your all done.

If you need to archive your emails stored in your account, you can do the same with “mail” folder. This does not include MySQL database backup if you use one. Please refer to MySQL section on how to do the backup.