We have already covered how to find the Process ID of a program in previous article. We didn’t share too many details in that article regarding ps command. So, here we will see how to list processes with ps command in Ubuntu.
A process is an instance of a program. Or, we can say – multiple windows of a program are going to create multiple instances. Each window of the program corresponds with an instance, which in turn is a process.
ps command mainly shows us the information about the current running processes. It generates a static report and it is generated the moment we execute the command. Furthermore, it doesn’t provides us the real-time data.
List processes with ps command in Ubuntu
To list all the running processes, we need to issue the following command in the terminal –
ps aux
Besides, we need to understand the information which we receive as an output. Here,
u is for the user,
x is for all the processes and,
a is for all the users.
Besides, we will discuss different combinations and discuss its associated output.
ps u
To list processes for the current user.
ps a
List processes for all the users, but doesn’t show which user is running what.
ps au
To list processes along-with users who are running those processes. But, there are processes which are running in the background. And, these doesn’t show up through above commands. Therefore, to list those processes we use x option.
ps aux
We would like to add here that, it is not necessary to use x along-with a & u options.
What does ps aux tells us?
After we run ps aux command, first row (at the top) – Headers tells us about the data in every column.
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
We start with USER – It basically shows us the user who has started the process.
PID – Process ID, a unique ID for every process.
%CPU – how much CPU percentage the process consumes.
%MEM – amount of RAM the process consumes.
VSZ – Virtual memory size (KB) of the process.
RSS – Resident set size, shows how much memory is being used.
TTY – the terminal interface.
STAT – It shows the state of the process, R – running process and S – sleeping process. You may find other state codes here. We will discuss them in coming articles.
START – when the process was started, shows the time.
TIME – how much CPU time was used.
COMMAND – self-explanatory.
In conclusion, we have covered how to list processes with ps command in Ubuntu.