Sunday, February 1, 2009

Backup selected files only

* Difficulty: Intermediate
* Application: tar

Want to use tar to backup only certain files in a directory? Then you'll want to use the -T flag as follows. First, create a file with the file you want to backup:

cat >> /etc/backup.conf
# /etc/passwd
# /etc/shadow
# /etc/yp.conf
# /etc/sysctl.conf
EOF

Then run tar with the -T flag pointing to the file just created:

tar -cjf bck-etc-`date +%Y-%m-%d`.tar.bz2 -T /etc/backup.conf

Now you have your backup.

source: http://www.linuxformat.co.uk/wiki/index.php/58_Cool_Hacks

No comments:

Blog Archive

About Me

Exclusion of liability Regarding StillStupid: The use you make of the guides, tips and downloads that you listed on this web site or on another website to which I refer is entirely at your own risk. In no way can I be held liable for damage or consequential damages of any kind, which occurs as a result of that use.