"Linux learning is not difficult" archive and compress (2): Use and management of tar packages

Source: Internet
Author: User

22.2 "Linux learning is not difficult" archive and compress (2): Use and management of tar packages
Using the tar command, you can save many files together to a separate tape or disk archive, and you can restore the required files separately from the archive.
Command syntax:
tar [options] [file | directory]
The meanings of the options in the command are as shown in the table.
Option option meaning
-C Create a new archive file
-A add tar file to archive
-R append file to end of archive
-T lists the contents of the archive to see which files have been backed up
-U only appends files that are newer than the copies in the archive
-X releasing files from the archive file
-F using an archive file or device
-K saves the file that already exists. Overwrite when you encounter the same file when restoring a file
-M create multi-volume archive for storage on several disks
-V detailed report on tar processing information
-C < directory > extract to a specific directory
-Z Archive via gzip filter
-J Filtering Archives via bzip2
-j via XZ Filter Archive
-A Use the archive suffix name to determine the compression program
Example: Archive/root/abc directory, generate file as/root/abc.tar.
[Email protected] ~]# tar cvf/root/abc.tar/root/abc
Tar: Remove the Beginning "/" from the member name
/root/abc/
/root/abc/a
/root/abc/b
/root/abc/c
Example: View the contents of a/root/abc.tar archive file.
[Email protected] ~]# tar Tvf/root/abc.tar
Drwxr-xr-x root/root 0 2015-12-23 12:24 root/abc/
-rw-r--r--root/root 0 2015-12-23 12:24 root/abc/a
-rw-r--r--root/root 0 2015-12-23 12:24 root/abc/b
-rw-r--r--root/root 0 2015-12-23 12:24 root/abc/c
Example: Unpacking the archive file/root/abc.tar.
[Email protected] ~]# tar Xvf/root/abc.tar
root/abc/
root/abc/a
Root/abc/b
Root/abc/c

This article is an excerpt from the "Linux learning is not difficult" textbook, this is the most practical, theoretical practice and emphasis on the introduction of Linux teaching materials.

"Linux learning is not difficult" archive and compress (2): Use and management of tar packages

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.