cli-tarHow do I use Unix tar and zip to compress files?
Using tar
and zip
in Unix is a great way to compress files. Here is an example of how to use tar
to compress a directory and all of its contents:
tar -zcvf compressed-directory.tar.gz directory-name
This command will create a file called compressed-directory.tar.gz
that contains all of the contents of directory-name
. The options used in the command are as follows:
-z
: Compress the archive using gzip-c
: Create a new archive-v
: Verbosely list files which are processed-f
: Use archive file or device ARCHIVE
You can also use zip
to compress files in Unix. Here is an example of how to use zip
to compress a single file:
zip compressed-file.zip file-name
This command will create a file called compressed-file.zip
that contains the contents of file-name
.
For more information about using tar
and zip
in Unix, see the following links:
More of Cli Tar
- How do I use the command line to tar and zip files?
- How do I use the command line to tar and distribute files?
- How do I use the shell to tar and zip files?
- How do I use the Unix tar zip command?
- How do I compare Unix tar and zip files?
- How do I use the Unix tar xvf command?
- How do I use tar gzip with a password?
- How do I use the tar command in Windows command line?
- How do I extract a .xz file using the command line?
- How do I create a Unix tar archive with a password?
See more codes...