cli-tarHow do I use the Unix tar command to compress a directory?
The tar
command is used to compress and extract files in Unix and Linux systems. To compress a directory, you can use the following command:
tar -czvf directory_name.tar.gz directory_name
This command will create a compressed .tar.gz
file in the current working directory.
tar
: This is the command to invoke the tar utility.-czvf
: This is the set of options used to compress the directory.-c
creates an archive,-z
compresses the archive with gzip,-v
displays the progress of the compression process, and-f
specifies the filename of the resulting archive.directory_name.tar.gz
: This is the name of the resulting archive.directory_name
: This is the name of the directory to be compressed.
For more information on the tar
command, see the GNU tar manual.
More of Cli Tar
- How do I use the Unix tar zip command?
- How do I use the command line to tar and zip files?
- How can I use tar commands to zip a file?
- How do I use the command line to tar and zip a file?
- 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 do I use the command line to tar and zip a file?
- How do I compare Unix tar and zip files?
- How do I use gzip, tar, and zip to compress files?
See more codes...