How to decompress the tar command in Linux. tgz and. tar.gz files

Source: Internet
Author: User

Such as:

Unzip the file in the current directory:

The code is as follows Copy Code

Tar zxvf my_name.tgz or tar zxvf MY_NAME.tar.gz

Example: View the contents of the Usr.tar backup file and display it as a split screen on the monitor.
  

The code is as follows Copy Code
$ tar TVF Usr.tar | More

Example: The/home directory includes its subdirectories to do all the backup files, the backup file name is Usr.tar.
  

The code is as follows Copy Code
$ tar cvf usr.tar/home

Example: The/home directory includes its subdirectories to do all backup files, and compression, backup file name usr.tar.gz.
  

The code is as follows Copy Code
$ tar czvf usr.tar.gz/home


Some of the other uses of tar


There are many options for the tar command (which can be viewed with man tar), but there are a few options that are commonly used, below
To illustrate:

The code is as follows Copy Code

# TAR-CF All.tar *.jpg

This command is to make all. jpg files into a package named All.tar. -C is to indicate the creation of a new package
,-f Specifies the file name of the package.

The code is as follows Copy Code
# TAR-RF All.tar *.gif

This command adds all the. gif files to the All.tar package. -R is the file that adds the
Mean.

The code is as follows Copy Code
# Tar-uf All.tar logo.gif

This command updates the logo.gif file in the original tar package All.tar, and-U is the meaning of the update file.

The code is as follows Copy Code

# TAR-TF All.tar

This command lists all the files in the All.tar package----------T is the list of files

The code is as follows Copy Code

# TAR-XF All.tar

This command is to solve all the files in the All.tar package------X is the meaning of the undo

# Note that the file name after the parameter F is taken by itself, and we are accustomed to using. Tar as a recognition.
# If you add the z parameter, you can use. tar.gz or. tgz to represent the gzip-compressed tar file ~
# If you add the J parameter, then the. tar.bz2 as the file name. ~

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.