Linux Tar Files: Difference between revisions
Jump to navigation
Jump to search
Brodriguez (talk | contribs) (Create page) |
(No difference)
|
Revision as of 07:11, 14 March 2020
Tar is one form of file compression commonly used on Linux machines.
Compress a File
To compress a file, use the command:
tar -czvf <name_of_archive> <path_to_file_or_directory>
Where:
<name_of_archive>is the name of the compressed file you'll create.<path_to_file_or_directory>is the path to the file or directory you wish to compress.czvfstands for:- c - Creates an archive (compressed file).
- z - Compresses using gzip format.
- v - Displays progress in terminal while compressing.
- f - Allows specification of archive name.
Extract a File
To extract a compressed file, use the command:
tar -xzvf <name_of_archive> -C <location_to_decompress_to>
Where:
<name_of_archive>is the name of the compressed file you'll create.<location_to_decompress_to>is the path you wish to extract contents to.xzvfstands for:- c - Extracts an archive (compressed file).
- z - Compression is in gzip format.
- v - Displays progress in terminal while compressing.
- f - Allows specification of archive name.