Using the tar
command
Create a compressed tar archive
$ tar -czvf archive.tar.gz ./directory
-c
: Create archive.
-z
: Compress using gzip
algorithm.
-f
: Specify filename of archive.
-v
: Verbose (show progress).
Uncompress a tar archive
$ tar -xvf archive.tar.gz
-x
: Extract from archive.
-f
: Specify filename of archive.
-v
: Verbose (show progress).
$ tar -xvf archive.tar.gz -C ./another-directory
-C
: Changes the directory.
$ tar -xvf archive.tar.gz file1 file2 file3
$ tar -xvf archive.tar.gz --wildcards '*.js'
List the content of tar archive
$ tar -tf archive.tar.gz