cli-tarHow do I compress a folder using tar and gz in the command line?
The tar
command can be used to compress a folder in the command line. The gz
option is used to compress the folder with the gzip
algorithm.
To compress a folder using tar
and gz
, use the following command:
tar -czvf <output-filename>.tar.gz <input-folder>
The flags used in this command are:
-c
: create a new archive-z
: compress the archive withgzip
-v
: verbose mode - show the progress while creating the archive-f
: specify the filename of the archive
The output of this command will be a single tar.gz
file containing the compressed folder.
Helpful links
More of Cli Tar
- How do I use the command line to tar and zip files?
- How can I use tar commands to zip a file?
- How do I compare Unix tar and zip files?
- How do I use gzip, tar, and zip to compress files?
- How do I use the Unix tar zip command?
- How do I create a tar.zip file in Unix?
- How do I use the command line to tar and zip a file?
- How do I use the shell to tar and zip files?
- How do I use the command line to tar and zip a file?
- How do I use the command line to tar and distribute files?
See more codes...