Sunday, January 25, 2009

Linux: Making backup using tar command

tar file
Make a tar file:tar cvf mybackup.tar some_folder/
List a tar file:tar tvf mybackup.tar
Unpack tar file:tar xvf mybackup.tar
tar.gz file
Make a tar.gz file:tar czvf mybackup.tar.gz some_folder/
Unpack tar.gz file:tar xzvf mybackup.tar.gz
List a tar.gz file:tar tzvf mybackup.tar
excluding some files
tar cvf mybackup.tar some_folder/ --exclude=*.mp3 --exclude=*.avi
example
tar cvf /Volumes/LaCie/staff_from_before_2008_05_20/from_mac/Desktop.tar Desktop/ --exclude=*.avi --exclude=*.rmvb --exclude=*.mp3 --exclude=*.jpg --exclude=*.mat