-x: Extract
-f: File Name
-v: Verbose
-c: Create (To archive)
-t: List
Basic Usages
List all files verbosely
tar -tvf backup.tar
Archive into one single file
tar -cvf archive.tar foo bar
Equivalent with standard output
tar -cv foo bar > archive.tar
Extract an archive file
tar -xvf backup.tar
Gzip
Basic Usages
Compress a file
gzip file.txt
Note: This command will replace the original file.
Equivalent with standard output
cat file.txt | gzip > file.txt.gz
Decompress a file
gzip -d file.txt.gz
Note: This command will replace the original file.
Comression level
gzip -N / --fast / --best
Regulate the speed of compression using the specified digit N, where -1 or --fast indicates the fastest compression method (less compression) and -9 or --best indicates the slowest compression method (best compression).
The default compression level is -6 (that is, biased towards high compression at expense of speed).
Archive files with compression
Tar archiving is often used together with a compression method, such as gzip, to create a compressed archive.
Tar
Tar Options
Basic Usages
List all files verbosely
Archive into one single file
Equivalent with standard output
Extract an archive file
Gzip
Basic Usages
Compress a file
Note: This command will replace the original file.
Equivalent with standard output
Decompress a file
Note: This command will replace the original file.
Comression level
Regulate the speed of compression using the specified digit N, where -1 or --fast indicates the fastest compression method (less compression) and -9 or --best indicates the slowest compression method (best compression).
The default compression level is -6 (that is, biased towards high compression at expense of speed).
Archive files with compression
Tar archiving is often used together with a compression method, such as gzip, to create a compressed archive.
(Source: https://en.wikipedia.org/wiki/Tar_(computing))
Compress an Archive using Gzip
Compress an Archive using Bzip2 and Xzip Compression
Bzip2 with
-j
xzip with
-J
tar -cvJf ~/backup-archive.tar.xz ~/backup/Accessing gzipped files
Gzip with multi-process
Materials