How to check Linux process information?
How to check Linux process information (CPU usage, memory, user information, etc.)?
You need to use the ps
command combined with the grep
command. In the example, we want to check the information on the nginx process :
ps aux | grep nginx
It would return the output :
root 9976 0.0 0.0 12272 108 ? S<s Aug12 0:00 nginx: master process /usr/bin/nginx -g pid /run/nginx.pid; daemon on; master_process on;
http 16780 0.0 0.0 12384 684 ? S< Aug12 4:11 nginx: worker process
http 16781 0.0 0.0 12556 708 ? S< Aug12 0:24 nginx: worker process
http 16782 0.0 0.1 12292 744 ? S< Aug12 2:43 nginx: worker process
http 16783 0.0 0.1 12276 872 ? S< Aug12 0:24 nginx: worker process
admin 17612 0.0 0.1 5120 864 pts/4 S+ 11:22 0:00 grep --color=auto nginx
The columns have the following order : USER;PID;%CPU;%MEM;VSZ;RSS;TTY;STAT;START;TIME;COMMAND
- USER = user owning the process
- PID = process ID of the process
- %CPU = It is the CPU time used divided by the time the process has been running.
- %MEM = ratio of the process’s resident set size to the physical memory on the machine
- VSZ = virtual memory usage of entire process (in KiB)
- RSS = resident set size, the non-swapped physical memory that a task has used (in KiB)
- TTY = controlling tty (terminal)
- STAT = multi-character process state
- START = starting time or date of the process
- TIME = cumulative CPU time
- COMMAND = command with all its arguments
Interactive display
If you want an interactive display showing in real time the statistics of the running process you can use the top
command. If htop
is available on you system, use this instead.