create one md5 for all files in folder

tar c folderName | md5
Sample Output

By: Whitefox
2015-05-15 13:08:33

What Others Think

You probably want this as md5sum instead of md5.
kboodu · 254 weeks and 3 days ago
It does more than you describe which is, unfortunately, a problem. tar will encode *everything*, files, dirs and all the filesystem metadata. That makes the command very fragile. Your md5sum is dependent on the contents and names of the files, the directories, the owner/group. . If I copy a directory tree, I would want the md5sum to be the same. But ... tar c folder1 | md5sum 5d41402abc4b2a76b9719d911017c592 cp -a folder1 folder2 tar c folder2 | md5sum 7d793037a0760186574b0282f2f435e7
flatcap · 254 weeks and 3 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: