Backing up a directory over SSH

Today I got an email from the IT department at UNM informing me that they'd be deleting my account in two weeks (I graduated December 2008 so I guess this was bound to happen eventually). Anyway, I still had a bunch of stuff on UNM's linux boxes that I wanted to keep so this is how I backed up my home directory:

ssh [email protected] "tar cfz - ." | cat >

What this is doing is tarring up everything in my home directory (with gzip compression) and sending it to stdout. I'm grabbing that info from stdin and writing it to a file.

Maybe someone else will find this useful.

PS. Here's how to do it in reverse:

tar cfz - . | ssh [email protected] "cat > /home/jmhobbs/backup.tar.gz"


Published: September 10, 2010

Author: jmhobbs

Word Count: 137


backup linux ssh

  • Tag Cloud


    Copyright © 2015 Jared Hobbs. All rights reserved. Powered by Pelican. The Hobbs Family theme available here.