cli-tarHow do I tar and compress a file in Unix?
Tarring and compressing a file in Unix is a two step process. First, the file is tarred using the tar command. Then, the tar file is compressed using a compression utility, such as gzip or bzip2.
For example, to create a tar file of the file myfile.txt and compress it with gzip, use the following command:
tar -czvf myfile.tar.gz myfile.txt
The output of this command will be:
myfile.txt
The parts of this command are:
tar: The command to create a tar file-czvf: Options used to compress the file withgzipand create a verbose outputmyfile.tar.gz: The name of the tar file that will be createdmyfile.txt: The file that will be tarred and compressed
For more information on using the tar command, see the GNU Tar Manual.
More of Cli Tar
- How do I use the command line to tar and zip files?
- How do I use the shell to tar and zip files?
- How do I create a tar.zip file in Unix?
- How do I use the command line to tar and distribute 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 Unix tar zip command?
- 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?
See more codes...