cli-tarHow do I gzip a tar file in Linux?
In Linux, you can gzip a tar file by using the gzip command. This command will compress the tar file into a gzip file, which is usually much smaller in size.
$ tar -cvf my_files.tar my_files/
$ gzip my_files.tar
The above example code creates a tar file called my_files.tar from the folder my_files/ and compresses it into a gzip file.
The tar command has the following parts:
-c: creates a tar file-v: verbose mode, prints the name of each file it archives-f: specifies the filename of the tar file
The gzip command has the following parts:
my_files.tar: the name of the tar file to be compressed
For more information about the tar and gzip commands, please refer to the following links:
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...