Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need a help on untaring a file when checksum matches.

Here is the scenario.

i have a tar file and its check sum is dfsafdafsafasfsaf232, stored in a checksum file and need a script to match this checksum file and extract to specific folder when matches.

Thanks in advance

share|improve this question
up vote 0 down vote accepted

Should be as easy as something like this.

md5sum --status --check checksumfile.md5
if [ $? -ne 0 ]; then
   echo >&2 "MD5 Failed"
   exit 1
  tar -xzf filename.tar.gz

Of course if you aren't using md5sum/sha*sum, then you may need to see if your checksum tool has a check mode, that returns the results as the error level.

share|improve this answer
Hello Zored, Thanks for quick answer. yes script saved my time. Thank You, – Bharathvn Jan 20 '11 at 9:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.