A tutorial on using the Tar tool to archive files under Linux

Source: Internet
Author: User

Tar is derived from the ' Tape Archiver (tape archive) ', which was originally used to archive and store files on tape. Tar is a GNU software that compresses a set of files (archives), extracts them, and operates on an existing archive file. It is useful for storing, backing up, and transferring files. When you create an archive, Tar keeps the original file and directory structure intact. Files archived through Tar have a suffix named '. Tar '.

The basic usage is as follows:

A) Create an archive (c/--create)

The code is as follows:

Tar--create--verbose--file=archive.tar file1 file2 file3

Or

The code is as follows:

Tar cvf archive.tar file1 file2 file3

Create an archive

(b) Listing the contents of the archive (t/--list)

The code is as follows:

Tar--list Archive.tar

List the files contained in the archive

c) Extraction Archive (x/--extract)

The code is as follows:

Tar xvf Archive.tar

Tar xvf archive.tar--wildcards ' *.c '

-Extracts a file with a suffix named *.c from the archive.

Extract Files

Extract only the required files

d) Update the archive (U/--update)

The code is as follows:

Tar UVF archive.tar newfile.c

-Add updated newfile.c to the archive if the archived newfile.c are newer than those previously archived.

Update an archive

(e) Delete files from the archive (--delete)

The code is as follows:

Tar--delete-f Archive.tar file1.c

-delete file ' file1.c ' from compressed package ' Archive.tar '

deleting files

For more specific use, refer to the TAR home page.

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.