I want to know exactly what this particular command
ps -ef|grep processname
means 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.
Best Answer
-e
and-f
are options to theps
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 2grep
find lines containing a patternprocessname
- the pattern forgrep
to search for in the output ofps -ef
So altogether
means: look for lines containing
processname
in a detailed overview/snapshot of all current processes, and display those lines