tar

tar - stores and extracts files from a tape or disk archive.


Create tar archive:

tar -cvf my_backup.tar /home/joe/

Create tar archive compressed with gzip:

tar -cvzf my_backup.tar.gz /home/joe/

Extract a tar file on current directory:

tar -xvf my_backup.tar

Extract a tar.gz file on current directory:

tar -zxvf my_backup.tar.gz

Extract a tar.gz file in a different directory:

tar -zxvf my_backup.tar.gz -C /temp/

List the content of tar.gz archive:

tar -tvf my_backup.tar.gz

Extract single file from tar.gz:

tar -zxvf my_backup.tar.gz info.txt

Extract group of Files:

tar -zxvf my_backup.tar.gz --wildcards '*.jpg'

Add files or directories to tar archive:

tar -rvf my_backup.tar.gz new_file.doc