verify tar archive

Posted on 2008-11-09
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

    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.
    LVL 8

    Assisted Solution

    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

    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
    LVL 8

    Assisted Solution

    To me, you seem to be asking only one question which was already answered.

    Author Comment

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

    However thanks everyone for you help..


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. Please see for the updated article. It is avail…
    Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap ( Version 1.2 2.      Jpcap( Version 0.6 Prerequisite: 1.      GCC …
    This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
    In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

    758 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

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now