The Tar of Linux basics

Source: Internet
Author: User

#未完待续

The only way to unlock a single file

If I just want to untie the package file,
One of the files in it, how do you do it? Vigilance simple, you just use-JTV to find the file name you want, and then the file name
You can undo it. We use the following example 杢 to illustrate:

# 1. First find our file name, fake ou untie shadow file OK:

[[Email protected]~]# tar-jtv-f/root/etc.tar.bz2 | Grep'Shadow'-R--------Root/root1230  -- the- in  Geneva: +: -etc/shadow--R--------Root/root622  -- the- in  Geneva: +: -etc/gshadow--R--------Root/root636  -- the- in  Geneva: +: -etc/Gshadow-R--------Root/root1257  -- the- in  Geneva: +: -Etc/shadow <==This is what we want! 

# 2. Untie the file! The astonished law does not practice as follows:

[Email protected] ~]# TAR-JXV-

Package a directory, but do not include some of the file practices in that directory

Fake ou we want to pack/etc//root a few important catalogs, but don't want to pack/root/etc* 's opening files because it
We've just created a backup file! and fake OU this new packing file to be placed/root/system.tar.bz2,
Of course this file does not have to pack itself (because this file is placed under/root!). ), we can now pass through the--exclude
Help! That exclude is not bag ton of meaning! So you can do this:

[Email protected] ~]# TAR-JCV  -f/root/system.tar.bz2--exclude=/root/etc* \

Backup only a new file than at some point

In some cases you will want to back up your new files and don't want to back up your old files! At this time--newer-mtime this election is the powder weight
I'll take it! In fact, there are two elections, one is "--newer" and the other is "--newer-mtime", the two choices are what
Not the same? We talked about three different time parameters in the touch introduction of the seventh chapter, and when using--newer, it means that subsequent
The date package ton "Mtime not CTime", and--newer-mtime is only mtime! That's it! ^_^.
Then let us 杢 try to deal with it!

 [[email protected] ~]# tar-jcv-f/root/etc.newer.then.passwd.tar.bz2 \  >--newer-mtime= 2008/09/29  /etc/*  

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.