The most well-known unzip tool under Linux

Source: Internet
Author: User
Tags bz2

Many times, sending or receiving large files and pictures over the internet is a headache. The compression and decompression tools are just the answer. Let's take a quick look at some open source tools that can make our work easier.

Tar

Tar is derived from the ' Tape archiver (tape archiver) ', which was originally used to archive and store files on tape. Tar is a GNU software that compresses a set of files (archives), extracts them, and operates on existing archived files. It is useful for storing, backing up, and transferring files. When you create an archive, Tar keeps the original file and directory structure intact. Files archived through Tar are suffixed with the name '. Tar '.

The basic usage is as follows:

A) Create an archive (c/–create)
Tar--create--verbose--file=archive.tar file1 file2 file3

Or

Tar cvf archive.tar file1 file2 file3

Create an archive

b) List the contents of the archive (T/–list)
Tar--list Archive.tar

List files included in an archive

c) Extract archive (x/–extract)
Tar xvf archive.tartar xvf archive.tar--wildcards ' *.c '  -  extracts files from the archive with the suffix named *.c.

Extracting files

Extract only the required files

d) Update the archive (U/–update)
Tar UVF archive.tar newfile.c   -  If the archived newfile.c is  newer than the previously archived, add the updated newfile.c to the archive.

Update an archive

e) Delete files from the archive (–delete)
Tar--delete-f archive.tar file1.c   -delete file ' file1.c ' from compressed package ' Archive.tar '

deleting files

Please refer to the TAR homepage for more specific usage methods.

Gzip/gunzip

Gzip is the GNU zip, a compression application that is widely used in Linux operating systems, with the suffix of its compressed files named ' *.gz '.

The basic usage is as follows:

A) Compress files
gzip file (s)

Each file will be compressed separately .

Compress files

Usually after the compression is complete, it will delete the original file. We can use the-C option to preserve the original file.

Gzip-c File > file.gz

Retain original files after compression

We can also compress a set of files into a separate file

Cat File1 file2 File3 | gzip > archieve.gz

Compress a group of files

b) Check the compression ratio

The compression ratio of compressed files can be verified by using the '-l ' option.

Gzip-l archieve.gz

Check the compression rate

c) Unzip the file

Gunzip is used to extract files, where the original (compressed) files are also deleted after being decompressed. Use the-C option to preserve the original file.

Gunzip-c archieve.gz

Unzip the file

Gzip plus the '-d ' option and gunzip have the same effect on compressed files.

More details are available from the GZIP homepage.

Bzip2/bunzip2

Like Gzip, BZIP2 is also a compression tool that compresses files to a smaller size than other traditional tools, but with the disadvantage that it runs slower than gzip.

The basic usage is as follows:

A) Compress files

In general, for compression, the BZIP2 does not have an option to pass the compressed file to its parameters. Each file is compressed separately, and the compressed file is suffixed with ' bz2′ '.

bzip2 file1 file2 File3

File compression

Using the '-K ' option allows you to retain the original file after compression or decompression.

Retain the original file after compression

b) Decompression

The '-d ' option is used to decompress.

Extracting files using the-D option

You can also use BUNZIP2 to decompress.

BUNZIP2 filename

Unzip the file

BUNZIP2 can decompress files with suffixes named bz2, BZ, tbz2 and TBZ. Files with tbz2 and TBZ are compressed and the suffix name becomes '. Tar '.

BZIP2-DC   -   performs the function of extracting files to standard output.
7-zip

7-zip is another open source compression software. It uses 7z for this new compression format and supports a high compression ratio. Therefore, it is considered to be a better software than the previously mentioned compression tool. Under Linux, available through the P7zip package, the package contains 3 binaries: 7z, 7za, and 7ZR, and readers can refer to the P7zip wiki to learn about the differences between these three binary files. In this article, we will use 7ZR to explain the usage of 7-zip. Archive file with '. 7z ' as the suffix name.

The basic usage is as follows:

A) Create an archive
7ZR a archive-name.7z file-name (s)/directory-name (s)

Create an archive file

b) List archive include files
7ZR L archive-name.7z

List files included in an archive

c) Extract the archive file
7ZR e archive-name.7z

Extract Archive

d) Update the archive file
7ZR u archive-name.7z new-file

Update an archive file

e) Delete files from the archive file
7ZR D archive-name.7z file-to-be-deleted

deleting files

Confirm File Deletion

The most well-known unzip tool under 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.