LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-06-2016, 01:19 PM   #1
pradeepspa
Member
 
Registered: Oct 2015
Posts: 79

Rep: Reputation: Disabled
What is "ps | md5sum"


Hi all,

as far I know md5sum generate a number which is used to check the integrity of file between source and destination. However when i run this command,
"ps awx | md5sum", I am getting md5 code which keeps changing everytime the mentioned command is ran . Could someone explain what is md5sum is doing with respect to ps command?

Thanks in Advance.
 
Old 04-06-2016, 01:39 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
md5sum, when provided with data on stdin, will generate the checksum of that data regardless of what it is. For example:
Code:
echo "hat" | md5sum
will return the md5 hash for the string "hat", which is "80c7384a6339a053baee278cb13e578c", and it will be the same every time you run it.

When you run "ps awx | md5sum", you're computing the md5 hash of the output of "ps aux". Since the output of "ps aux" is different every time you run it (processes starting/stopping, different runtimes for existing processes, etc.), naturally the md5 hash will be different as well.

Last edited by suicidaleggroll; 04-06-2016 at 01:44 PM.
 
2 members found this post helpful.
Old 04-06-2016, 02:20 PM   #3
pradeepspa
Member
 
Registered: Oct 2015
Posts: 79

Original Poster
Rep: Reputation: Disabled
Thanks for the explanation. Helped me lot. What is the purpose of generating md5sum for ps?
 
Old 04-06-2016, 02:25 PM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
Quote:
Originally Posted by pradeepspa View Post
Thanks for the explanation. Helped me lot. What is the purpose of generating md5sum for ps?
its the digital equivalent of paying someone to dig a hole and paying someone else to fill it.
 
Old 04-06-2016, 02:29 PM   #5
pradeepspa
Member
 
Registered: Oct 2015
Posts: 79

Original Poster
Rep: Reputation: Disabled
ah gotcha. Thanks all
 
Old 04-06-2016, 03:59 PM   #6
Markx7
LQ Newbie
 
Registered: Apr 2016
Posts: 4

Rep: Reputation: Disabled
Quote:
Originally Posted by pradeepspa View Post
What is the purpose of generating md5sum for ps?
Probably they're just experimenting with md5sum. There's no value doing a md5sum on the output of ps unless they just wanted to generate a string of characters to use for something else.

I look at md5sum as a quick way of signing files and checking the sums. I prefer to use GPG to sign files and use a signature key to verify the integrity of my files.

Last edited by Markx7; 04-06-2016 at 04:00 PM.
 
Old 04-07-2016, 11:15 AM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
They might have thought of it as "a random string," on the presumption that the output of "ps" would never be exactly the same. But, I don't like to see code that incorporates either "assumptions" or "cleverness."
 
Old 04-07-2016, 03:02 PM   #8
pradeepspa
Member
 
Registered: Oct 2015
Posts: 79

Original Poster
Rep: Reputation: Disabled
I have actually found that in a script. I will dig further to see why exactly it was used for
 
Old 04-07-2016, 04:51 PM   #9
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
They might be using it as some kind of pseudo random number generator, but there are better ways if that's the end goal.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Remapping a Northgate Omnikey "Omni" button to serve as a "Windows" or "Super" key. CVAlkan Linux - Hardware 6 01-07-2019 12:21 PM
[SOLVED] X: "loading extension glx" "no screens found" "fatal server error" (w/ nvidia driver) Geremia Slackware 7 12-29-2014 11:00 AM
[SOLVED] "net rpc" "failed to connect to ipc$ share on" or "unable to find a suitable server" larieu Linux - General 0 11-09-2014 12:45 AM
md5sum from coreutils 8.15 "--check" option brodo Slackware 8 02-10-2012 09:19 AM
LXer: Displaying "MyComputer", "Trash", "Network Servers" Icons On A GNOME Desktop LXer Syndicated Linux News 0 04-02-2007 08:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:36 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