Linux tar command usage

Source: Internet
Author: User
Tags rar extension uncompress

Run the linux tar command at the end of the dig command. After the tar package is generated, you can use other programs to compress it. So let's first talk about the basic usage of the tar command: there are many options for the www.2cto.com tar command (which can be viewed using man tar), but there are several commonly used options. The following is an example: # tar-cf all.tar *. the 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. The command www.2cto.com # tar-uf all.tar logo.gif is updated to the logo.gif file in tarbao all.tar.-u indicates the meaning of the update file. # 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, -t means to undo it. The above is the most basic usage of tar. To help you compress or decompress files while packing and unpackage, tar provides a special feature. This means that tar can call other compression programs, such as gzip and bzip2, while packaging or unpacking. 1) tar call gzip gzipis a compressed program developed by gnuorganization. The file ending with .gz is the result of gzip compression. The decompress program relative to gzip is gunzip. Use the-z parameter in tar to call gzip. The following is an example: # tar-czf all.tar.gz *. jpg is used to compress all .jpg files into a tar package and use gzip to generate a gzip compressed package named all.tar.gz # tar-xzf all.tar.gz. 2) tar call bzip2 bzip2is a more powerful compression program. The file ending with .bz2 is the result of bzip2 compression. The decompress program relative to bzip2 is bunzip2. Use the-j parameter in tar to call gzip. The following is an example: # tar-cjf all.tar.bz2 *. the command jpg is to compress all .jpg files into a tar package and use bzip2 to compress them. The package named all.tar.bz2 # tar-xjf all.tar.bz2 is used to unbind the package generated above. 3) tar calling compress is also a compression program, but it seems that there are not as many people using compress as gzip and bzip2. The file ending with. Z is the result of bzip2 compression. The decompress program relative to compress is uncompress. Use the-Z parameter in tar to call gzip. The following is an example: # tar-cZf all.tar. Z *. the jpg command is to compress all .jpg files into a tar package and generate an uncompress compressed package named all.tar. Z # tar-xZf all.tar. the Z command is used to unbind the generated package. You should be able to uncompress multiple types of compressed files. The following is a summary of the compressed files in the tar series: 1. For the file tar-xf all.tar 2 at the end of .tar, for the file gzip-d all.gz gunzip all.gz 3 at the end of .tgzor .tar.gz, tar-xzf all.tar.gz tar-xzf all. tgz 4)for the file bzip2-d all.bz2 bunzip2 all.bz2 5)for the file tar-xjf all at the end of tar.bz2. t Ar.bz2 6). file uncompress all. Z 72.16.tar. file tar-xZf all.tar. in addition, z has corresponding methods to decompress the compressed files .zipand .rar under Windows. Linux also provides zip and unzip programs for. zip linux, zip is a compression program, and unzip is a decompression program. They have many Parameter options. Here we will only give a brief introduction and give examples to illustrate their usage: # zip all.zip *. jpg files are compressed into a zip package # unzip all.zip. This command is used to extract all files in all.zip from www.2cto.com 2). to process .rar files under linux, you need to install RAR for Linux. You can download files from the Internet, but remember, RAR for Linux is not free; then install: # tar-xzpvf rarlinux-3.2.0.tar.gz # cd rar # make this installation is done, after installation there are rar and unrar these two programs, rar is a compression program, unrar is a decompression program. They have many Parameter options. Here we will only give a brief introduction. We will still give an example to illustrate their usage: # rar a all *. jpg command is to compress all. jpg files into a rarpackage named all.rar. the program will automatically append the .rar extension to the package name. # Unrar e all.rar this command is used to extract all files from all.rar, we have already introduced tar, gzip, gunzip, bzip2, bunzip2, compress, and unzip in linux.

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.