Linux common file Compression/decompression command __linux

Source: Internet
Author: User
Tags bz2 gz file memory usage rar

Some common compressed files:

*. Z Files compressed by Compress program
*.bz2 Files compressed by bzip2 program
*.gz GZIP Program Compressed Files
*.tar The TAR program is packed with data that has not been compressed
*.tar.gz The TAR program packages the files, which are compressed by gzip.
*.zip Zip Program compressed file
*.rar RAR Program Compressed file

Tar

The archive tool below Linux. Files or directories are archived, grouped into one file, but not compressed.
Syntax format
tar [main options + auxiliary options] File or directory list

Cases:

Tar xcvf file.tar.gz file

Tar xzvf file.tar.gz ~/

Main options
-C Create a new profile
-R append files to file to end of file
-t list of files that have been archived in the profile
-U updates the file and replaces the original file with the new file. If the file does not exist in the backup file, append it to the end of the backup file
-X Restore files from profile

Secondary options
-F archived to normal files
-K to save a file that already exists. For example, during the restore process, the same files are encountered and are not overwritten
-M when the file is restored, change the time of all files to the current time
-V report detailed process of tar
-W to confirm every step of the way
-Z compress/decompress files with gzip
-J compressed/uncompressed files via bzip2
-Z Filters files through the Compress program.

Gzip & Gunzip

Syntax format
gzip [Options] Compressed (uncompressed) file name

Gzip compresses source files to. gz files by default and deletes the original files

Common options
-C writes the output to the standard output and retains the original file
-D Decompression of compressed files
-l display fields for each compressed file: Compressed file size, uncompressed file size, compression ratio, name of uncompressed file
-R recursively finds the specified directory and compresses or compresses all of its files.
-T check that the compressed file is complete
-V Display file name and compression ratio for each compressed and decompressed file
-num sets the compression ratio with the specified number num,-1 or-fast indicates the minimum compression ratio,-9 or-best represents the highest compression ratio. System defaults are 6

Zip & Unzip

Syntax format
Unzip [options] compresses file names. zip

Common options
-X file list to extract files without including the files specified in the file list
-V View compressed file directory, but don't understand the pressure
-t test file for damage, but does not understand the pressure
-D directory to extract compressed files to the specified directory
-Z Show only annotations for compressed files
-N does not overwrite files that already exist
-O overwrites existing files and does not require user confirmation
-j does not reconstruct the document's directory structure, extracting all files to the same directory

bzip2

Syntax format
bzip2 [option][-compression level] Compressed file name

Common options
-C or--stdout send the results of compression and decompression to standard output
-D or--decompress to perform the decompression
-F or--force bzip2 when compressing or decompressing, if the output file has the same name as an existing file, the preset does not overwrite the existing file, and to overwrite it, you need to use this parameter
-h or--help display Help
A-K or--keep bzip2 deletes the original file after compression or decompression, which is required to preserve the original file
-S or--small reduces memory usage during program execution
-T or--test test. bz2 the integrity of compressed files
-V or--verbose displays detailed information when compressing or decompressing a file
-Z or--compress force execution of compression
-V or--version display version information
--repetitive-best You can use this parameter to increase the compression effect if there is duplicate content in the file
--repetitive-fast You can use this parameter to speed up execution if there are recurring contents in the file

See also summary of commands for Linux compressed files

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.