Linux Study Notes 4 compression and decompression commands

Source: Internet
Author: User
Linux Study Notes 4-compressed and decompressed commands links: Linux Study Notes 1 file Operation Commands http://www.2cto.com/os/201211/169196.html Linux study Note 2 permission management commands http://www.2cto.com/os/201211/169485.html Linux learning notes... Linux learning Notes 4. compression and decompression commands links: Linux learning Notes 1 file Operation Commands http://www.2cto.com/os/201211/169196.html Linux study Note 2 permission management commands http://www.2cto.com/os/201211/169485.html Linux learning Note 3 file search command http://www.2cto.com/os/201211/169489.html 1. compressed file www.2cto.com gzip the format of the compressed file is .gz. Features: only files can be compressed and directories cannot be compressed; do not retain the gzip file name of the source file [root @ CentOS-Test data] # gzip xx_lhc.txt [root @ CentOS-Test data] # ls bak lost + found testdir1 testdir2 xx_lhc.txt.gz2. decompress the file [root @ CentOS-Test data] # gzip-d xx_lhc.txt.gz [root @ CentOS-Test data] # ls bak lost + found testdir1 testdir2 xx_lhc.txt3, and the tar package directory name is the .tar.gz tar parameter: -c: .tar package file-v: Show Details-f: specify the compressed file name-z: package and compress [root @ CentOS-Test data] # tar-zcvf newdir.tar.gz testdir1 testdir1/but use file filename to determine the file type. not supported, however, first package and then compress [root @ CentOS-Test data] # tar-cvf xx_lhc.tar xx_lhc.txt [root @ CentOS-Test data] # gzip xx_lhc.tar4, decompress the tar command in the folder, and extract the parameter-x: decompress the. tar file-f: specifies the decompressed file-v: displays details-z: decompress [root @ CentOS-Test data] # tar-xzvf xx_lhc.tar.gz xx_lhc.txt zip compression command, you can not only compress files, but also compress directories (using the-r parameter). the source files still exist when the files are compressed, for example, compressed files: [root @ CentOS-Test data] # zip xx_lhc.zip xx_lhc.txt adding: xx_lhc.txt (deflated 22%) 22% is the compression ratio [root @ CentOS-Test data] # ll-rw-r --. 1 root 428 November 18 20:00 xx_lhc.txt-rw-r --. 1 root 502 November 18 21:30 xx_lhc.zip compression directory for example: [root @ CentOS-Test data] # zip-r bak.zip bak adding: bak/(stored 0%) adding: bak/lhc.txt (deflated 22%) adding: bak/Li Haichao personal information .txt (deflated 22% ). zip-format decompression command: the unzip zip package name bzip2zip command, the zip file is relatively large, the compression ratio is very high, the format is .bz2, only the file can be compressed, use the-k parameter to retain the original file name [root @ CentOS-Test data] # bzip2-k xx_lhc.txt-rw-r --. 1 root 378 November 18 20:00 xx_lhc.txt.bz2 uncompress the file in the .bz2 format [root @ CentOS-Test data] # bunzip2 xx_lhc.txt.bz2
Related Article

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.