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 do I use the command line to tar and zip files?
- How do I use the tar command line in Windows 10?
- How can I fix an unexpected end of file error when compressing a file with tar and gzip?
- How do I use the Unix tar zip command?
- How do I use the Unix tar xvf command to extract files?
- How can I use the tar command in Unix to create archives in quiet mode?
- How do I use tar and gzip to password protect a file?
- How do I use shell tiki tar to compress files?
- How do I read a tar.gz file using gzip?
- How can I track the progress of a Unix tar operation?
See more codes...