Some compression and archiving commands in linux

Source: Internet
Author: User
Some compression and archiving commands in linux I. Common compression and decompression tools compressuncomprss suffix: zgzipgunzip suffix: gzbzip2bunzip2 suffix: bz2zip some compression and archiving commands in linux I. Common compression/decompression tools compress/uncomprss suffix :. z gzip/gunzip suffix :. gz bzip2/bunzip2 suffix :. bz2 zip/unzip suffix :. zip note: The first compress is not very common, and the last three are popular compression/decompression tools. ii. use 1) gzip $ gzip filename // to compress a file, however, after compression, the original file will be deleted $ gunzip fielname.gz // after decompression, the .gz file will be deleted $ gzip-d filename.gz // equivalent to gunzip filename.gz $ gzip-c filename> filename.gz // used to compress the original file and retain the original file $ gzip-n filename // customize the compression level (level <1-9> compression ratio from low to high, the higher the compression speed, the lower the compression speed. the default value is 6) $ zcat filename.gz // Check the compressed file content without any pressure. note: gzip cannot compress the Directory (if the directory is compressed, (2) bzip. the compression ratio is relatively higher than that of gzip. the format used is similar to that of gzip, however, the original file $ bzip-k filename // is retained after compression. $ bzip2-k filname.bz2 // The original file $ bzcat filename.bz2 is retained during decompression. // You do not need to decompress the file to view the compression. file content note: bzip can only compress a single file, but cannot compress directories. 3) zip, you can archive and compress $ zip test.zip filename1 filename2 filename3 at the same time // compress several files into one file at the same time (do not delete the original file or decompress or delete the original compressed file). note: zip can be used to compress the directory, and the compressed file name can be customized. 4) tar, file archiving command (no compression is performed on the file itself) $ tar-cf test.tar filename1 filename2 filename3 // you must specify the file name after archiving.-c: archive,-f: specify the file name $ tar-tf test.tar // view the content of the archive file $ tar-xf test. tat // expand the content of the archive file $ tar-cvf test.tar filename1 filename2 filename3 // archive these three files,-v: show the archive process information $ tar-xvf test.tar // expand the archive file and display the process information 3. archive tool tar box gzip, bzip2 works with $ tar-zcvf test.tar.gz filename1 filename2 filename3 // Archive and compress these three files $ tar-zxvf unzip // decompress and "unarchive" $ tar-jcvf unzip filename1 filename2 filename3 // Archive and compress these three files $ tar-jxvf test.tar.bz2 // decompress and "unarchive" $ tar-jxvf test.tar.bz2-C/tmp //-C: specifies the directory to which the files are extracted. the default value is the current directory.

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.