cli-tarHow do I use gzip with tar?
Using gzip with tar allows for the compression of multiple files into one file with the .tar.gz extension. This is done by using the tar command with the -z or --gzip flag.
For example, to compress the files file1.txt and file2.txt into a single file called archive.tar.gz, you would use the following command:
tar -czvf archive.tar.gz file1.txt file2.txt
The output of the above command should look something like this:
file1.txt
file2.txt
The command is made up of the following parts:
tar: The command to create an archive.-czvf: Flags that mean to create an archive, compress it with gzip, verbosely list the files being archived, and save it to a file.archive.tar.gz: The name of the output file.file1.txt&file2.txt: The files to be archived.
For more information, please see the following resources:
More of Cli Tar
- How do I use the command line to tar and zip files?
- How can I use tar commands to zip a file?
- How do tar gzip and zip differ in terms of file compression?
- How do I use the shell to tar and zip files?
- How do I use the Unix command tar?
- How do I use the Unix tar zip command?
- How do I use gzip, tar, and zip to compress files?
- How do I use the command line to tar and zip a file?
- How do I use the command line to create a tar file?
- How do I compress a file using gzip and tar.xz?
See more codes...