Linux file archive management-tar

Source: Internet
Author: User
Linux file archive management-tar1.1tar introduction the tar command is a common method for compressing and decompressing files in Unix/Linux systems. it can work in almost any environment and has the permission of all users. --------------------------------------------------------------... Linux file archive management-tar 1.1tar introduction tar command is a common method for compressing and decompressing files in Unix/Linux systems. it can work in almost any environment and its permission is granted to all users. When you use the tar [main option + auxiliary option] file or directory parameter in the format of tar 1.2tar syntax to use this command, the main option is required and tells tar what to do, the secondary option is used as an aid and can be used. Main option:-c create a new archive file. Select this option if you want to back up a directory or some files. -R: append the file to be archived to the end of the file. For example, if you have prepared a backup file and find that there is another directory or some files have forgotten to be backed up, you can use this option to append the directory or files you have forgotten to the backup file. -T list the file content and check which files have been backed up. -U updates the file. That is to say, replace the original backup file with the new file. if the file to be updated cannot be found in the backup file, append it to the end of the backup file. -X releases a file from the file. 3.2 Auxiliary option:-B this option is set for the drive, followed by a number to indicate the block size. the default value is 20 (20 × 512 bytes ). -F this option is usually required when you use an archive file or device. -K: save the existing file. For example, if a file is restored, the same file will not be overwritten during restoration. -M sets the modification time of all files to when restoring files. -M: create a multi-volume archive file to store it on several disks. -V details the file information processed by tar. If this option is not available, tar does not report file information. -W each step requires confirmation. -J indicates that the 'bzip2' program is used to compress the file.-z uses gzip to compress/decompress the file. With this option, the file can be compressed, however, this option must be used for decompression during restoration. Tar common commands:-c: Create a compressed file-x: extract-t: View content-r: append a file to the end of the compressed archive file-u: update the five files in the original compressed package as independent commands. one of them is required for compression and decompression. it can be used with other commands, but only one of them can be used. The following parameters are optional when files are compressed or decompressed as needed. -Z:-j with gzip attributes:-Z with bz2 attributes:-v with compress attributes: displays all processes-O: it is required to unbind the file to the standard output parameter-f: use the file name. Remember, this parameter is the last parameter and can only be followed by the file name. # The tar-cf all.tar *. jpg command is to pack all. jpg files into a package named all.tar. -C indicates that a new package is generated.-f specifies the package file name. # Tar-rf all.tar *. gif this command adds all. gif files to the package of all.tar. -R indicates adding files. # Tar-uf all.tar logo.gif is a new logo.gif file in tarbao all.tar.tar.-u indicates the file to be updated. # The tar-tf all.tar command is to list all files in the all.tar package.-t indicates to list the files. # The tar-xf all.tar command is to extract all files in the all.tar package, -x is the meaning of unlocking ------------------------------------------------------------- compressed tar-cvf jpg.tar *. jpg // Pack all jpg files in the directory into TAR.jpg tar-czf jpg.tar.gz *. jpg // tar-cjf jpg.tar.bz2 *. jpg // tar-cZf jpg.tar. Z *. jpg // response. zrar a jpg.rar *. for jpg/rar compression, download rar for linuxzip jpg.zip * first *. jpg // zip compression, download the zip for linux unzip and unzip tar-xvf file.tar // extract the tar package tar-xzvf file.tar.gz // decompress tar.gz tar-xjvf file.tar.bz2 // decompress tar.bz2 tar-xZvf file.tar. Z // decompress tar. zunrar e file.rar // Extract rarunzip file.zip // extract the zip file into 1.4tar ,*. decompress tar with tar-xvf 2 ,*. use gzip-d or gunzip to decompress gz 3, * .tar.gz, and *. use tar-xzf to decompress tgz 4 and ,*. bz2 uses bzip2-d or bunzip2 for decompression 5.*.tar.bz2 uses tar-xjf for decompression 6 and ,*. use uncompress to decompress Z ,*. tar. Z uses tar-xZf to decompress 8 and ,*. rar unrar e extract 9 ,*. unzip for zip
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.