I use Ubuntu Server 10.10 and I would like to see what processes are running. I know that PostgreSQL is running on my machine but I can not see it with the top
or ps
commands, so I assume that they aren't showing all of the running processes. Is there another command which will show all running processes or is there any other parameters I can use with top
or ps
for this?
How to see what processes are running
monitoringprocessprocess-management
Best Answer
From the
ps
man page:Thus,
ps -e
will display all of the processes. The common options for "give me everything" areps -ely
orps aux
, the latter is the BSD-style. Often, people then pipe this output togrep
to search for a process, as in xenoterracide's answer. In order to avoid also seeinggrep
itself in the output, you will often see something like:where foo is the process name you are looking for.
However, if you are looking for a particular process, I recommend using the
pgrep
command if it is available. I believe it is available on Ubuntu Server. Usingpgrep
means you avoid the race condition mentioned above. It also provides some other features that would require increasingly complicatedgrep
trickery to replicate. The syntax is simple:where foo is the process for which you are looking. By default, it will simply output the Process ID (PID) of the process, if it finds one. See
man pgrep
for other output options. I found the following page very helpful:http://mywiki.wooledge.org/ProcessManagement