How to Check Running Process in ubuntu Linux

This post will guide you how to check running process in your Ubuntu Linux from the command line. How do I display all running processes using various commands at the shell prompt.

check running process ubuntu2

Listing All Running Process with ps Command in Ubuntu


You can use the ps command to list all running processes in your Ubuntu system, type:

$ ps -a 
$ ps -aux

Outputs:

devops@devops:~$ ps -a
PID TTY TIME CMD
1451 tty1 00:00:00 gnome-session-b
1465 tty1 00:00:16 gnome-shell
1546 tty1 00:00:00 Xwayland
2312 tty1 00:00:00 ibus-daemon
2464 tty1 00:00:00 ibus-dconf
2468 tty1 00:00:00 ibus-x11
2648 tty1 00:00:00 gsd-xsettings
2665 tty1 00:00:00 gsd-a11y-settin
2679 tty1 00:00:00 gsd-clipboard
2692 tty1 00:00:00 gsd-color
2701 tty1 00:00:00 gsd-datetime
2714 tty1 00:00:00 gsd-housekeepin
2721 tty1 00:00:00 gsd-keyboard
2746 tty1 00:00:00 gsd-media-keys
2830 tty1 00:00:00 gsd-mouse
2851 tty1 00:00:00 gsd-power
......

Looks Through the Currently Running Processes in Ubuntu


If you want to find a running process by name from your current Ubuntu system, you can use a command called pgrep.

For example, you wish to looks throught the currently running processes and only list the processes called “systemd”, you can type the following command at the shell prompt:

$ pgrep systemd

Outputs:

devops@devops:~$ pgrep systemd
1
281
290
718
837
999
1420
3923

If you only want to list the processes called “systemd” and owned by root user, just using the following command:

$ pgrep -u root systemd

outputs:

devops@devops:~$ pgrep -u root systemd
1
281
290
837

Display Running Processes with Top and Htop Commands in Ubuntu


If you want to display a dynamic real-time view of your running processes in your system, and you can use top command to display running processes. this command also display the most memory and cpu usage. Type:

$ top

or

$ htop

outputs:

$ top

top - 02:46:11 up 48 min, 2 users, load average: 0.03, 0.17, 0.44
Tasks: 277 total, 1 running, 243 sleeping, 0 stopped, 0 zombie
%Cpu(s): 3.3 us, 4.3 sy, 0.1 ni, 86.8 id, 5.2 wa, 0.0 hi, 0.3 si, 0.0 st
KiB Mem : 1006668 total, 72472 free, 768232 used, 165964 buff/cache
KiB Swap: 2097148 total, 1280252 free, 816896 used. 73352 avail Mem

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
5339 devops 20 0 51316 3972 3284 R 20.0 0.4 0:00.05 top
37 root 20 0 0 0 0 S 10.0 0.0 0:59.69 kswapd0
3300 root 20 0 303652 2456 2456 S 5.0 0.2 0:00.03 cups-browsed
1 root 20 0 225616 5544 4032 S 0.0 0.6 0:01.99 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_gp
4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_par_gp
6 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/0:0+
8 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mm_percpu_wq
9 root 20 0 0 0 0 S 0.0 0.0 0:01.06 ksoftirqd/0
10 root 20 0 0 0 0 I 0.0 0.0 0:01.80 rcu_sched
11 root rt 0 0 0 0 S 0.0 0.0 0:00.02 migration/0
12 root -51 0 0 0 0 S 0.0 0.0 0:00.00 idle_inject+
13 root 20 0 0 0 0 I 0.0 0.0 0:02.18 kworker/0:1+
14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/0
15 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs
16 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 netns

check running process ubuntu1

Kill a Process in Ubuntu


If you want to kill a process in your Ubuntu system, and you need to find the PIDs using ps or pgrep command, and you can use kill command to kill it.

For example, the process ID is 2345, and you want to kill it, just type the following command:

$ kill 2345

or

$ kill -9 2345

Kill a Process by Name in Ubuntu


If you want to kill a process by name in your Ubuntu system, and you can use pkill command.

For example, you wish to kill a process called “httpd”, just using the following command:

$ sudo pkill httpd

Kill Processes by Name in Ubuntu


if you want to kill all processes by name, and you can try to use killall command. type:

$ sudo killall processName
$ sudo killall httpd

Conclusion


You should know that how to list/kill/lookup process with ps/pgrep/kill/killall/pkill commands in your Ubuntu Linux.

You might also like:

Sidebar



back to top