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 do I use the Unix tar zip command?
- How do I create a tar.gz file using a shell script?
- How do I use tar gzip with a password?
- How can I use tar commands to zip a file?
- How do I use the command line to create a tar file?
- How do I use gzip, tar, and zip to compress files?
- How do I extract files from a tar archive using the cmd command?
- How do I use the tar command on Windows?
- How do I use the command line to tar and zip files?
- How do tar gzip and zip differ in terms of file compression?
See more codes...