cli-tarHow do I use gzip to compress myfile.tar?
- To compress a file
myfile.tarusing gzip, use the following command:
gzip myfile.tar
This will create a new compressed file myfile.tar.gz in the same directory.
- The
gzipcommand uses the Lempel-Ziv (LZ77) algorithm to compress the file. - The
-voption 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
-koption can be used to keep the original file after compression:
gzip -k myfile.tar
- The
-roption can be used to recursively compress all files in a directory:
gzip -r mydirectory
- To decompress a file, use the
gunzipcommand:
gunzip myfile.tar.gz
- For more information on the
gzipcommand, see the GNU gzip manual.
More of Cli Tar
- How do I use the Unix tar zip command?
- How do I use the Unix tar xzvf command?
- How do I use the Unix tar xvf command to extract files?
- How do I use gzip with tar?
- How do I use gzip to compress a tar file on Windows?
- How can I use the CLI to yield a tar file?
- How can I use gzip to compress a file without using tar?
- How can I decide between using tar gzip and bzip2 for compressing files?
- How do I use the shell to tar and zip files?
- How do I use tar commands with xz?
See more codes...