Linux Unzip command

Source: Internet
Author: User
Tags gz file

1, Tar-cvf/data/sc2.tar/data (package only, do not compress)

Pack the files under the/data into Sc.tar. All two of them are absolute paths.

tar-zcvf/data/sc2.tar.gz/data<== after packaging, compress with gzip

2. Unzip the/tmp/etc.tar.gz file under/USR/LOCAL/SRC
[Email protected] ~]# CD/USR/LOCAL/SRC
[Email protected] src]# tar-zxvf/tmp/etc.tar.gz

---------------------

3, go to a directory, and then extract the other absolute path of the compressed files into this folder

Example

Cd/data/sc5

Tar-zxvf/data/sc6.tar.gz extract the files from this directory to the folder above "Note:. tar file not yet"

4, compress a folder, but exclude a folder under the

Tar--exclude/data/home-zcvf xin2.tar.gz/data "/data/home folder and the folder below is not compressed"

Another example:

I want to back up/home, etc, but don't/home/dmtsai
[Email protected] ~]# tar--exclude/home/dmtsai-zcvf myfile.tar.gz/home/*/etc

tar [-cxtzjvfppn] files and directories ....
Parameters:
-C: Create a compressed file parameter directive (the meaning of Create);
-x: Unlock the parameter instructions for a compressed file!
-T: View the files inside the Tarfile!
In particular, in the release of the parameters, c/x/t can only exist one! Cannot exist at the same time!
Because it is not possible to compress and decompress simultaneously.
-Z: Do you have the properties of gzip at the same time? i.e. do I need gzip compression?
-j: Do you have bzip2 properties at the same time? i.e. is it necessary to compress with bzip2?
-V: Files are displayed during compression! This is commonly used, but is not recommended for use in the background execution process!
-F: Use the file name, please note, after F to immediately answer the file name Oh! Don't add any more arguments!
For example, using "TAR-ZCVFP tfile sfile" is the wrong way to write
"TAR-ZCVPF tfile sfile" Just right!
-P: Use original file properties (attributes are not changed according to user)
-P: You can use absolute path to compress!
-N: Newer than next date (YYYY/MM/DD) will be packaged in the new file!
--exclude file: In the process of compression, do not package file!

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.