How to check running process in Linux using command line

www‮‬.lautturi.com
How to check running process in Linux using command line

To check the running processes on a Linux system using the command line, you can use the ps command. This command displays a list of processes currently being executed on the system, including the process ID, the command that started the process, and the user that owns the process.

To check the running processes on a Linux system, open a terminal window and run the following command:

ps aux

The ps command will display a list of all processes currently being executed on the system, including the process ID, the command that started the process, the user that owns the process, the CPU and memory usage of the process, and the status of the process.

For example, the output might look something like this:

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0  46772  5180 ?        Ss   00:50   0:00 /sbin/init
root         2  0.0  0.0      0     0 ?        S    00:50   0:00 [kthreadd]
root         3  0.0  0.0      0     0 ?        S    00:50   0:00 [ksoftirqd/0]
root         5  0.0  0.0      0     0 ?        S<   00:50   0:00 [kworker/0:0H]
root         6  0.0  0.0      0     0 ?        S    00:50   0:00 [kworker/u4:0]
root         7  0.0  0.0      0     0 ?        S    00:50   0:00 [migration/0]
root         8  0.0  0.0      0     0 ?        S    00:50   0:00 [rcu_bh]
root         9  0.0  0.0      0     0 ?        S    00:50   0:00 [rcu_sched]
root        10  0.0  0.0      0     0 ?        S    00:50   0:00 [lru-add-drain]
root        11  0.0  0.0      0     0 ?        S    00:50   0:00 [watchdog/0]

In this example, the ps command is displaying a list of processes running on the system, including the init process (PID 1), the kthreadd process (PID 2), and the ksoftirqd/0 process (PID 3). The USER column shows the user that owns the process, the PID column shows the process ID, the %CPU column shows the CPU usage of the process, and the %MEM column shows the memory usage of the process.

To check the running processes for a specific user, you can use the ps command with the -u option and the username.

For example, to check the running processes for the root user, you can use the following command:

ps aux | grep root

This will display a list of processes running on the system that are owned by the root user.

To check the running processes for a specific process name, you can use the ps command with the -C option.

ps -C
Created Time:2017-10-28 21:38:59  Author:lautturi