Linux command (TAR)

Source: Internet
Author: User
Tags rar

Server migration, so you need to copy the files on their virtual machine to local, because the file is too large, so compression, review the TAR command

1:tar Introduction

-C: New packaging files can be paired with-V to see the process of the file name (fileName)-X: Unpacking or decompression function, can be used with-C (uppercase) in a specific directory to unlock-t: View the contents of the packaged file contains those file names, Focus on viewing the file name-r: Append file to the end of the compressed archive-u: Update the files in the original compressed package

These five are stand-alone commands, which use one of the compression decompression, and can be used with other commands but only one. The following parameters are optional when compressing or extracting files as needed.

-Z: Compression/decompression via gzip support, at this time the file name is preferably *.TAR.GZ-J: compression/Decompression through BZIP2 support, at this time the filename is best *.tar.bz2



-f:filename, after the file name to be processed. Suggested-F is written separately as a parameter
-C: Directory, this parameter can be used to decompress a specific directory at the time of decompression.

  

2:tar Basic Applications

# TAR-CF All.tar *.jpg
This command is to make all. jpg files into a package named All.tar. -C is the file name that represents the generation of a new package,-f specifies the package.

# TAR-RF All.tar *.gif
This command adds all the. gif files to the All.tar package. -R is meant to increase the file.

# Tar-uf All.tar logo.gif
This command is to update the original tar package All.tar in the logo.gif file,-U is to indicate the meaning of the update file.

# TAR-TF All.tar
This command is to list all the files in the All.tar package,-T is to list the meaning of the file

# TAR-XF All.tar
This command is to solve all the files in the All.tar package,-X is the meaning


  Compression

    • TAR–CVF Jpg.tar *.jpg package All JPG files in the directory into tar.jpg
    • TAR–CZF jpg.tar.gz *.jpg package All JPG files in the directory into Jpg.tar and compress them in gzip to generate a gzip compressed package named jpg.tar.gz
    • TAR–CJF jpg.tar.bz2 *.jpg package All JPG files in the directory into Jpg.tar, and then compress them in bzip2 to generate a bzip2 compressed package named jpg.tar.bz2
    • TAR–CZF jpg.tar.z *.jpg package All JPG files in the directory into Jpg.tar, and then compress them in compress to generate a umcompress compressed package named Jpg.tar.z
    • RAR a jpg.rar *.jpg rar format compression, you need to download RAR for Linux first
    • Zip jpg.zip *.jpg zip format compression, you need to download the zip for Linux first

  Extract

    • TAR–XVF File.tar Unpacking the TAR Package
    • TAR-XZVF file.tar.gz Decompression tar.gz
    • TAR-XJVF file.tar.bz2 Decompression tar.bz2
    • Unrar e file.rar decompression rar
    • Unzip File.zip Unzip zip

  Summarize

      1. *.tar Decompression with TAR–XVF
      2. *.gz extract with gzip-d or gunzip
      3. *. tar.gz and *.tgz with TAR–XZF decompression
      4. *. bz2 with bzip2-d or with BUNZIP2 decompression
      5. *.TAR.BZ2 Decompression with TAR–XJF
      6. *. Z Extract with Uncompress
      7. *.tar. Z Extract with Tar–xzf
      8. *.rar with Unrar e decompression
      9. *.zip decompression with unzip

Linux command (TAR)

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.