Trivial use of md5sum

I just made use of the [[md5sum]] command in a rather simple situation which could have been more troublesome to handle with other means. The following scenario highlights, IMHO, how [[command line]] greatly simplifies some tasks.

I have a file file.txt, and a collection of files file.txt.N, where N = 1, 2, 3… I know that the former is a copy of one of the latter, but I don’t know which. I could have run [[diff]] on all the possible matches, but I would have had to run it for every N until a match was found. However, md5sum comes to rescue. I can just run:

% md5sum file.txt*

And check which file.txt.N has a MD5 signature equal to file.txt, so that one would be the match. This solution is still a bit annoying, because I have to visually search matches for a long string. Not to worry! Unix is our friend once again. Recover the above command with a single press to the “up” arrow, then extend the command a tiny bit:

% md5sum file.txt* | sort

Now, since the MD5 signatures are sorted, the match for our file.txt (if there is any), will appear right after the line for file.txt.

I challenge the reader to accomplish the same task as readily, comfortably and successfully in Windows or Mac, or in Linux without the command line.


  1. sylvainulg said,

    November 12, 2009 @ 17:43 pm

    So true.

    Btw, is there any chance you could get the MD5 hash with a freshly installed windows at all ? i mean, such as “to check a downloaded executable for conformance against a known hash before executing it”, and thus, not requiring to download an extra tool first.

  2. isilanes said,

    November 13, 2009 @ 12:01 pm

    Hi sylvainulg!

    There are so many things one can’t do with a freshly installed Windows! 99% of programs people like in Windows (e.g. games, Photoshop, …) are third-party. Even core utilities by Microsoft, like those in MS Office, are actually sold separately (and are quite expensive).

    And yet other things, although quite simple and/or free, are not available. It is fine that MS developed NTFS, but why are Windows users deprived of other free file systems such as ext2/3/4, ReiserFS, JFS, XFS…? It’s just an arbitrary decision of the powers that be in Redmond. Likewise for shells. MS has developed their own shell… that’s OK. But why can’t Windows users make use of other free shells such as bash, zsh, (t)csh..? Is there any alternative for the desktop environment? KDE, GNOME, Xfce, Fluxbox….? KDE is being ported to Windows, but of course without any help from MS.

    Wouldn’t those extras (such as KDE) give more value to their product? The moral is that MS gives a damn about added value. Making Windows objectively better is not a goal. Making money is. This much, the reader knows. However, it might come as a tiny surprise that both things (making Windows better and making more money out of it) are not necessarily linked, as so many people assume.

  3. sylvainulg said,

    December 23, 2009 @ 14:57 pm

    as for “alternative environments” over Windows, I suggest you give litestep (or its derivative) a try …

  4. isilanes said,

    December 23, 2009 @ 15:34 pm

    Thanks for the suggestion, sylvainulg!

    I won’t take much advantage of it, because I wouldn’t touch Windows with a 3-meter pole, unless it’s a friends computer or something (in which case I will not be in position to change the desktop environment). BTW, how unfortunate is it that MS decided to call their DE “[[Windows Shell]]”? From Unix, shell = “command line”, and desktop environment and/or window manager = “graphical interface”. But, oh well.

    The thing is not whether it is feasible to somehow change the DE or trick Windows to use ext3 (there are drivers that allow you to do that). The point is that users would find it desirable to have an easy choice when choice is due (e.g. DE), or default and transparent compatibility when no choice is needed (e.g. file system support). Huge credit should go to MS’s master minds for their ability to dumb-down the user so much that she doesn’t even see the need of any change. She (the user) lives in a cage, the bars of which she is conditioned not to see, so she believes she is free, or, worse even, she doesn’t give a second thought to what freedom is. There is no further horizon beyond MS cage, so not being able to plug a JFS pendrive into Windows must somehow be a fault on JFS’s side. Likewise not being able to use zsh in Windows, or installing GNOME or KDE.

    The irony is that whenever “Windows-only” software doesn’t work on free OSs it is so because the software excludes itself from them (through being proprietary and closed source, so no port is possible), while the reverse is not true. When free software doesn’t run on Windows it is so because it is the OS that works hard not to welcome it. And we all know why: compatibility brings free competition, and free competition brings fear and defeat for proprietary software.

RSS feed for comments on this post · TrackBack URI

Leave a Comment