Linux Tar Compressed archive Management Command Learning

Source: Internet
Author: User
Tags bz2 backup

Profile:

Tar is the main file compression and decompression, is a more commonly used command.

Command format:

tar [-cxtzjvfppn] pathname [pathname ...]

Parameters:

-C: Create an archive

-X: Unlocking an Archive

-T: View an archived content

-Z: Archive compression or decompression with gzip

-j: Compress or decompress archive with bzip2

-V: Show detailed process

-F: Use file name, followed by file name directly

-r: Append file to end of file

--delete: Deleting files from files

-P: Do not change the original properties of the file

-N: Archive only updated files, followed by date (YYYY/MM/DD)

--exclude file: Do not package the following files

Example:

1, packaging/home but not compression

Tar-cvf/filepath/filename.tar/home

2, to gzip compression and packaging

Tar-zcvf/filepath/filename.tar.gz/home

3. Compress and pack with BZIP2

Tar-jcvf/filepath/filename.tar.bz2/home

4, view the tar file content

Tar-tvf/filepath/filename.tar

5, view the content of gzip files,

Tar-ztvf/filepath/filename.tar.gz

6, view bzip2 file contents

tar-jtvf/filepath/filename.tar.bz2

7, back up the/home directory and save permission settings

Tar-zxvpf/filepath/filename.tar.gz/home

8, Backup/home in the directory than the 2009/05/28 new files

Tar-n "2009/05/28"-zcvf/filepath/filename.tar.gz/home

9, Backup/home directory, but do not back up the/home/slyar directory

Tar--exclude/home/slyar-zcvf/filepath/filename.tar.gz/home

10, back up the/home directory for home.tar.gz, only extract/home/slyar.sh files

TAR-ZXVF home.tar.gz home/slyar.sh

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.