cli-tarHow do I use gzip or tar to compress a file?
Using gzip or tar to compress a file is a simple process.
To compress a file using gzip, use the following command:
gzip <filename>
This will create a new file with the same name but with the extension .gz
. The original file will remain unchanged.
To compress a file using tar, use the following command:
tar -zcvf <filename>.tar.gz <filename>
This will create a new file with the extension .tar.gz
. The original file will remain unchanged.
Code explanation
gzip
: command to compress a file using gzip<filename>
: name of the file to be compressedtar
: command to compress a file using tar-zcvf
: flags used with tar to compress the file.tar.gz
: extension of the compressed file
Helpful links
More of Cli Tar
- How do I use the command line 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 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?
- 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...