tar.gz creation and extraction

tar -zxvf file.tar.gz # Extracts
tar -zcf file.tar.gz directorytocompress/ # Creates

From the tar manual: ($ man tar)

-c : Creates an archive
-x : Reads (extracts) an archive
-f [file] : Read the archive from or write the archive to the specified file. The filename can be - for standard input or standard output.
-z : gzip-compressed
-v : Produces verbose output. In create and extract modes, tar will list each file name as it is read from or written to the archive.

Article Type

General