Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Up: update How to Update an Archive Using --update

You must use file name arguments with the --update (-u) operation. If you don't specify any files, tar won't act on any files and won't tell you that it didn't do anything (which may end up confusing you).

To see the --update option at work, create a new file, classical, in your practice directory, and some extra text to the file blues, using any text editor. Then invoke tar with the ‘update’ operation and the --verbose (-v) option specified, using the names of all the files in the practice directory as file name arguments:

     $ tar --update -v -f collection.tar blues folk rock classical

Because we have specified verbose mode, tar prints out the names of the files it is working on, which in this case are the names of the files that needed to be updated. If you run ‘tar --list’ and look at the archive, you will see blues and classical at its end. There will be a total of two versions of the member ‘blues’; the one at the end will be newer and larger, since you added text before updating it.

(The reason tar does not overwrite the older file when updating it is because writing to the middle of a section of tape is a difficult process. Tapes are not designed to go backward. See Media, for more information about tapes.

--update (-u) is not suitable for performing backups for two reasons: it does not change directory content entries, and it lengthens the archive every time it is used. The GNU tar options intended specifically for backups are more efficient. If you need to run backups, please consult Backups.

  Published under the terms of the GNU General Public License Design by Interspire