cli-tarHow do I create a .tar.gz file on Unix?
Creating a .tar.gz file on Unix can be done using the tar command.
tar -czvf <filename>.tar.gz <directory>
This command will create a .tar.gz file containing the contents of the specified directory.
tar
: The command used to create a .tar.gz file-c
: The flag used to create a new archive-z
: The flag used to compress the archive with gzip-v
: The flag used to verbosely list the files being archived-f
: The flag used to specify the filename of the archive<filename>
: The filename of the archive<directory>
: The directory to be archived
For example, to create a .tar.gz file of the example
directory, the command would be:
tar -czvf example.tar.gz example
This will create a .tar.gz file called example.tar.gz
containing the contents of the example
directory.
Helpful links
More of Cli Tar
- How can I use tar commands to zip a file?
- How do I use the command line to tar and zip files?
- 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 shell to tar and zip files?
- How do I use the command line to tar and zip a file?
- How do I create a tar.zip file in Unix?
- 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...