LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-14-2010, 12:28 AM   #1
tranduyhung
LQ Newbie
 
Registered: Sep 2010
Location: Vietnam
Distribution: Debian, Lubuntu
Posts: 10

Rep: Reputation: 0
Explain commands to save md5sum of files in a folder into a text file


Hello,
I've found these commands in https://help.ubuntu.com/community/LiveCDCustomization:
Quote:
find -type f -print0 | sudo xargs -0 md5sum | grep -v isolinux/boot.cat | sudo tee md5sum.txt
But I don't understand these commands, even after reading their manuals.
Someone please explain for me.
Sorry for my English.
Thank you very much!
 
Old 09-14-2010, 12:47 AM   #2
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
Find files of type regular and separate them with NULs (to account for spaces and such) and for some bizarre reason, pipe them into sudo. (Ubuntu. *shrug*) Regardless, xargs will build a command list out of them (also expecting NUL separators) and md5sum them. Grep will exclude any files named 'isolinux/boot.cat' and some more craziness with sudo and then tee will display the list to the terminal and write the md5sums to the file md5sum text. (AFAICT, none of the sudos make any sense, especially as find would need to have root perms to go looking through root-read-only dirs or whatever.)

That's the gist, I think.

-- Oh, and welcome to LQ!

Last edited by slakmagik; 09-14-2010 at 12:49 AM. Reason: noticed poster was making first post
 
1 members found this post helpful.
Old 09-14-2010, 05:38 AM   #3
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Yeah, the find '-print0' and xargs '-0' are special options that allow these two programs to communicate using the NUL terminators instead of whitespace terminators, which makes the command work on file names that have spaces. '-type f' means find files. Note that grep '-v' inverts matches, so you can think of it as anything matched is removed instead of kept. tee just reads from stdin and outputs to both stdout and a file.
 
1 members found this post helpful.
Old 09-14-2010, 05:42 AM   #4
tranduyhung
LQ Newbie
 
Registered: Sep 2010
Location: Vietnam
Distribution: Debian, Lubuntu
Posts: 10

Original Poster
Rep: Reputation: 0
Thank you slakmagik and H_TeXMeX_H,
I understand now .
This forum is really helpful!
 
Old 09-14-2010, 06:08 AM   #5
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
Seems an overly complicated way of doing things. md5sum will happily take imput from stdin, so the xargs are also completely unnecessary and the whole thing can be simplified to something along the lines of.

sudo "find . -type f ! -path './isolinux/boot.cat' | md5sum | tee md5sum.txt"

Last edited by GazL; 09-14-2010 at 06:10 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
gedit cannot save text file, type mailbox file ! snailchess Linux - Newbie 10 02-26-2011 04:57 AM
how do i md5 hash all files in a sub-folder and save it as a file? steve51184 Linux - Software 2 09-14-2009 06:38 PM
save web page results in a file and a folder. Whats the folder for? geeyathink General 2 01-30-2008 06:57 AM
Utility Needed - list folder tree and files in text file Optiker Linux - Software 21 11-17-2006 02:46 PM
Explain MD5SUM LinuxPadawan Linux - General 3 07-27-2005 11:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration