One of the important tasks you should regularly perform when managing your dedicated server, is to monitor the running processes. While the “top” command will provide you with a glimpse of the most active processes, the “ps” command can give you all of them or the specific ones you want.
As an introduction to ps, try typing “ps” by itself from the command line. The output will look like this:
PID TTY TIME CMD
845 pts/1 00:00:00 bash
868 pts/1 00:00:00 ps
PID stands for “process identifier” and is an easy way for you to manage processes. CMD stands for “command” and is another way to manage a process.
To see the processes of a specific user, type:
ps ux
That will show all of the running processes for the current user. To choose which user’s processes it displays, enter:
ps U username
Replace “username” with the name of the user you want to view.
To see all of the processes of every user, type:
ps aux
In this format, you are viewing the PID, percentage of CPU power used by the process, the percentage of memory used, the date when a process was started, the time, and a few other pieces of information.
You may notice that the output can get long if you have a good number of processes running. To scroll through the results a line at a time, type:
ps aux | less
You can also search for specific processes using grep. For example, to search for apache, enter:
ps aux | grep apache
It will then show only the processes with the command name apache. There are many other ways you can customize ps to give you just the output you need. For complete documentation, type “man ps” from the command line.