I want to know exactly what this particular command
ps -ef|grep processnamemeans and how it works. I know that this should be associated with processname which we want to search for, but I don't get the prefix part; what do -ef and |(pipe) do and how does -ef|grep as a whole work. Upon googling a bit I found grep is used for searching purposes, but I would love a simple explanation of how this command setting works.
1 Answer
-e and -f are options to the ps command, and pipes take the output of one command and pass it as the input to another. Here is a full breakdown of this command:
ps- list processes-e- show all processes, not just those belonging to the user-f- show processes in full format (more detailed than default)command 1 | command 2- pass output of command 1 as input to command 2grepfind lines containing a patternprocessname- the pattern forgrepto search for in the output ofps -ef
So altogether
ps -ef | grep processnamemeans: look for lines containing processname in a detailed overview/snapshot of all current processes, and display those lines