File Compression in Linux

Source: Internet
Author: User

Compress an entire Directory or a single File

Use the following command to compress an entire directory or a single file on Linux. It ' ll also compress every other directory inside a directory of your specify–in other words, it works recursively.

TAR-CZVF Name-of-archive.tar.gz/path/to/directory-or-file

Here's what those switches actually mean:

    • -c:create an archive.
    • -z:compress the archive with gzip.
    • -v:display progress in the terminal while creating the archive, also known as "verbose" mode. The V is always optional in these commands, but it ' s helpful.
    • -f:allows you to specify the filename of the archive.

Let's say you has a directory named "Stuff" in the current directory and you want to save it to a file named Archive.tar. Gz. You ' d run the following command:

TAR-CZVF archive.tar.gz Stuff

Or, let's say there ' s a directory at/usr/local/something on the current system and you want to compress it to a file name D archive.tar.gz. You ' d run the following command:

TAR-CZVF archive.tar.gz/usr/local/something

File Compression in Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.