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

Is there a way to for the tar command to check for new files that are not already in the archive, or those that have been deleted (for good measure)?

share|improve this question

You could use tar -d to see if local filesystem files are different or missing.

To add new files, just use tar -u to add only files newer than the copy in the archive.

tar -cvf /tmp/backup.tar /home # adds all files
echo Hello > /home/newfile.txt
tar -uvf /tmp/backup.tar /home # adds only newfile.txt
rm /home/newfile.txt
tar -df /tmp/backup.tar /home # gives an error about newfile.txt missing
share|improve this answer

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.