cli-tarHow do I use gzip to compress myfile.tar?
- To compress a file
myfile.tar
using gzip, use the following command:
gzip myfile.tar
This will create a new compressed file myfile.tar.gz
in the same directory.
- The
gzip
command uses the Lempel-Ziv (LZ77) algorithm to compress the file. - The
-v
option can be used to get verbose output about the compression process:
gzip -v myfile.tar
Output example
myfile.tar: 78.1% -- replaced with myfile.tar.gz
- The
-k
option can be used to keep the original file after compression:
gzip -k myfile.tar
- The
-r
option can be used to recursively compress all files in a directory:
gzip -r mydirectory
- To decompress a file, use the
gunzip
command:
gunzip myfile.tar.gz
- For more information on the
gzip
command, see the GNU gzip manual.
More of Cli Tar
- How do I use the Unix tar zip command?
- How do I use the command line to tar and distribute files?
- How do I create a tar.zip file in Unix?
- How do I use the Unix tar xvf command to extract files?
- 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 use gzip, tar, and zip to compress files?
- 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 zip a file?
See more codes...