Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


verify tar archive

Posted on 2008-11-09
Medium Priority
Last Modified: 2013-12-27
have one more doubt regarding tar command. i have extracted the tar file, say test.tar , to the folder "ABC".
Now i removed some files and changed the contents of some other files in the folder "ABC".
Is there any way to check the files in the folder "ABC" aganist the test.tar.
In short, what is the way to VERIFY the contents of extracted tar file against tar file
Question by:conversekid
LVL 19

Assisted Solution

jools earned 320 total points
ID: 22918299
You could list the contents of the tar file and compare the files to an ls -al output.

I dont believer there is a specific verify option in tar.

Assisted Solution

97WideGlide earned 480 total points
ID: 22918811
1) Create directory "ABCD"
2) Extract tar file to "ABCD"
3) Run 'diff' or 'dircmp" on "ABC" and "ABCD" as in dircmp -s ABC ABCD

Hope this does it.
Good Luck
LVL 48

Accepted Solution

Tintin earned 1200 total points
ID: 22919429
You are asking two seperate questions.  The first is comparing the files on the system to those in the tar file and the second is verifying the tar file.

To verify the validity of the tar file, do

tar tf file.tar

If it is corrupted, you'll get a tar error.

To compare the files on the system against the files in the tar file, extract the tar file to a temporary location, eg:

cd /tmp
tar xvf file.tar
dircmp /tmp/ABC /real/locations/ABC

Assisted Solution

97WideGlide earned 480 total points
ID: 22922690
To me, you seem to be asking only one question which was already answered.

Author Comment

ID: 22958617
Hi 97WideGlide:,
I am afraid I dint really understand what you are saying..

However thanks everyone for you help..


Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question