# backup linux files and dirs with tar
tar -options tar-file 'files and dirs to tar'
# backup some files and dirs
tar -czvf /usr/local/sbin/backup.tar.gz \
/etc/hostname \ # file
/etc/hosts \ # file
/etc/networks \ # file
/etc/network/ \ # dir
/etc/dhcp / \ # dir
/etc/bind/ \ # dir
/opt/
# dir
# use hostname, date and time in tar filename
tar -czvf "/usr/local/sbin/bkp_$(hostname)_$(date '+%Y-%m-%d_%H-%M-%S').tar.gz" \
/etc/hostname \ # file
/etc/hosts \ # file
/etc/networks \ # file
/etc/network/ \ # dir
/etc/dhcp/ \ # dir
/etc/bind/ \ # dir
/opt/
# dir
# OPTIONS:
-c create tar-file
-z compress with gzip
-j compress with bzip2
-v verbose, show more
-f tar filename with extension
-t list contents
-x extract tar-file
-r instead of -c append to tar-file
# list contents of tar-file:
-tzvf gzip file
-tjvf bzip2 file
# extract tar-file
-xzvf gzip file
-xjvf bzip2 file