//View Tip #362
» Fix the previous command
» Directories and its size
» Bash function to decompress archives
» CDPATH
Similar Tips
» Local/remote webserver» Fix the previous command
» Directories and its size
» Bash function to decompress archives
» CDPATH
Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
If you work on remote boxes a lot, you ll probably need a to backup a directory from there onto your machine sooner or later.. This can easilly be done using ssh & tar; all in 1 line of (script friendly) code:
Substitute user & server by the relevant info; /foo by the map you need and bar with the stuff you dont need; execute the command; login to the server when asked & Blamo! You ll have a nice backup.date.tgz file on your machine :)
ssh user@server "cd /foo && tar cvz * --exclude=bar*" > backup.$( date +%y%m%d ).tgz
Substitute user & server by the relevant info; /foo by the map you need and bar with the stuff you dont need; execute the command; login to the server when asked & Blamo! You ll have a nice backup.date.tgz file on your machine :)
Comments
Add your comment
lsh is an implementation of the ssh v2 protocol, so lsh & ssh have similar features :)
Posted 2008-09-22 14:19:50
i believe you are a good writer, but have you erver thought to write some special artcals for peopel who likes shopping very much.
Posted 2010-07-15 22:49:28


bubo@castor:~$ lsh 192.168.0.139 tar cf - /opt2/bubo/musik/[n-s]* | (cd /home/bubo/ && tar -xf -)
by the way: i love this site. thanks a lot for publishing such a huge amount of useful stuff. if you don't believe that look at this:
bubo@castor:~$ grep shell-fu .bashrc
alias shell-fu='w3m -dump http://www.shell-fu.org/lister … php?random | tail -n +27 | tee -a /home/bubo/saveme/shell-fuus.txt' :-)
regards