. NET Programmer Learning Linux (iii)

Source: Internet
Author: User
Tags gz file tar extract unpack

  Basic Commands

ll file name command to see the size of the file

File file name can be seen in the filename suffix, size

compression and decompression tools

These compression tools, as I understand it, should rarely be used separately, and should be used in conjunction with other commands or tools.

gzip is used to compress filesGZIP-V file name------> ZIP file and Show details of the compressed file after Gzip-l compressed file------> can also view the details of the compressed file, the following uncompressed file and compression, here is followed by the compressed File name gzip-9-C file name------> Compressed files, 9 refers to the level of compression, the higher the compression rate is higher,-C refers to, after compression continues to keep the original file does not disappear Zcat. GZ the contents of the compressed file end---------& gt; You can view the contents of the compressed file gzip-d. gz file-----> Unzip. gz file BZ, a tool with a higher compression rateBzip2-z file name-----> Compressed files, bzip get the bz2 file suffix, so the compression rate is higher, but it takes longer. bzip2-9-C file name-----> Compress files and retain the original file, 9 is the problem of compression rate Bzcat Compressed filename-----> If it is a compressed file file, you can use this to open the Lzma file name------> compress the file to. LZMA's compressed file suffix, which is higher than the previous two compression efficiency Unlzma compressed file----> unzip file ZipZIP Specifies that the generated file name specifies compressed files---> is also compressed, does not know the compression efficiency, but zip is also familiar with, that is, Windows can also run ZIP-R specifies the generated file name/path----> files in the compressed folder Unzi P File name-----> unzip file XZUnzip the source code package, compress the file XZ fd.config-----> compress The specified file xz-d fd.config.xz-----> Unzip the file xz-k fd.config----> do not delete the original file after compression

Tar: Compressed folder You can compress the entire folder before you canTAR-C------> Create the. tar format package file tar-x------> unpack the. tar format package file tar-v------> Output Details tar-f------> represents the name specified with the archive (before compression, Refers to the name to be compressed, after compression refers to which file to extract) tar-p------> Packaging to preserve the original file and directory permissions tar-t-------> list to view the files within the package tar-c------> Specifies that the release to the specified destination file tar-z------> call a third-party program to compress, call gziptar-j-------> Call bzip2 Program for compression or decompression, because if compressed by-j or-Z, Then you need to view the file in the same way, so the. bz2 suffix: tar-jtvf etc.tar.bz2------->-j means to view it in a bzip2 way tar complete Create compression command/unzip commandtar-cpzvf/root/etc.tar.gz/etc------->z using GZ The first path is to specify the file name that is generated the last path is the folder to be packaged see what files are in the compressed package [[email protected]~]# TAR-ZTVF etc.tar.gz------> need to correspond to good-Z or-j, what kind of program is compressed to compress by invoking the--lzma command with the tar commandTar--lzma-cvvf Etc.tar.lzma (Specifies the compressed file name) Etc.tar (specify files to compress)-----------> Specify to use Lzma compressed files [[email protected]~]# TAR-LZMA-CVVF Etc.tar.lzma test/etc.tar.gz----> Packaging Compressed files [[email protected]~]# tar--lzma-xvvf etc.tar.lzma-c directroy1--------> Unzip the file and specify the release directory, but will also extract the test file into the Directory1 specify to unzip a file in [compressed file]Sometimes we just want to get one of the files in the compressed file, then we use the pipe symbol to find the file first, then extract the file directly [[email protected]~]# TAR-ZTVF etc.tar.gz | grep ' host* '-----> Find all files for host [[email protected]~]# tar-zxvf etc.tar.gz etc/ssh/ssh_host_rsa_key.pub------> The first directory is the package to unpack, the second directory is the file to be unpacked in the package faster archive of compressed filesPBZIP2, explore the core of the machine and perform multicore processing [[email protected]test]# TAR-CVF etc.tar/etc---> Pack files from/etc to Ect.tar faster archive compressed files PBZIP2, explore the core of the machine and perform multicore processing [[email protected]test]# TAR-CVF etc.tar/etc---> Pack the files under/etc to Ect.tar first------------------ Installing PBZIP2--------------------First use Yum to find out if there is an installation package [[email protected]test]# Yum Search pbzip2 get pbzip2.x86_64 results then install [[email protected]test]# Yum Install pbzip2.x86_64 so that the installation is complete using PBZIP2 compressed files [[email protected]test]# pbzip2 Etc.tar Extract files using pbzip2 [[email protected]test]# pbzip2-d etc.tar.bz2 using pbzip2 compressed files [[email protected]test]# pbzip2-p2 Etc.tar Specify how many cores to unzip the file points to note when backing up:When backing up, try not to bring/directory, otherwise it will overwrite the contents of the system, using P can set the path to the root/directory backup file: 1. Create a directory [[email protected]~]# mkdir backup2. Package The important directory in the specified file [[email protected]~]# TAR-CVVF Backup/backup.tar.gz/etc/home/root/var/spool/cron

. NET Programmer Learning Linux (iii)

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.