cli-tarHow can I get the best compression when using tar and gzip?
The best compression when using tar and gzip can be achieved by using the -9
flag. This flag will enable maximum compression. The example code below shows how to use the -9
flag:
tar -czvf archive.tar.gz -9 file1 file2
The -c
flag tells the tar command to create an archive, -z
tells it to compress the archive using gzip, -v
is for verbose output and -f
specifies the filename of the resulting archive. The -9
flag enables maximum compression.
Code explanation
-c
: Create an archive-z
: Compress the archive using gzip-v
: Verbose output-f
: Specify the filename of the resulting archive-9
: Enable maximum compression
For further information, please refer to the following resources:
More of Cli Tar
- How can I use tar commands to zip a file?
- 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 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 files?
- How do I use gzip, tar, and zip to compress files?
- How do I use the command line to tar and zip a file?
- How do I use the Unix tar xzvf command?
- How do I use the command line to tar and zip a file?
See more codes...