Backup selected files only

by Sanju 2010-01-29 16:14:19

Backup selected files only

Want to use tar to backup only certain files in a directory? 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.

Tagged in:

899
like
0
dislike
0
mail
flag

You must LOGIN to add comments