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
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

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

  




 

 

Previous: delete, Up: Advanced tar


4.2.6 Comparing Archive Members with the File System

The --compare (-d), or --diff operation compares specified archive members against files with the same names, and then reports differences in file size, mode, owner, modification date and contents. You should only specify archive member names, not file names. If you do not name any members, then tar will compare the entire archive. If a file is represented in the archive but does not exist in the file system, tar reports a difference.

You have to specify the record size of the archive when modifying an archive with a non-default record size.

tar ignores files in the file system that do not have corresponding members in the archive.

The following example compares the archive members rock, blues and funk in the archive bluesrock.tar with files of the same name in the file system. (Note that there is no file, funk; tar will report an error message.)

     $ tar --compare --file=bluesrock.tar rock blues funk
     rock
     blues
     tar: funk not found in archive

The spirit behind the --compare (--diff, -d) option is to check whether the archive represents the current state of files on disk, more than validating the integrity of the archive media. For this later goal, See verify.

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