nix, shell, perl, php, mysql and mac os x tips and tricks

Monday, October 20, 2003

Fun with tar and gzip

recursively backup files and directories, excluding some:
tar -czvf /home/site/backup.tar.gz /home/site/cgi-bin --exclude=mysubdir

append more files/dirs to an existing archive:

tar -r --file=/home/site/backup.tar /home/site/more_stuff

don't forget to gzip it when you're done!

gzip /home/site/backup.tar

list the contents of a tar.gz

gzip -dc /home/site/backup.tar.gz | tar tvf -

No comments:

Post a Comment