How To Kill Process In Ubuntu?

Processes are the main part of the Ubuntu operating system in order to accomplish different tasks. A typical Ubuntu system runs lots of processes in daily routine. In some cases, we may need to kill a process in Ubuntu. There may be different reasons to kill or stop the process in Ubuntu. In this tutorial, we examine different ways to kill processes in Ubuntu via the command-line interface or GUI for the regular users or root user.

List Processes

Generally, in order to kill a process, its name or process ID should be known and this is generally done via listing processes and filtering them. The ps command can be used to list running processes and grep command can be used to filter these processes according to their names.

$ ps aux
List Processes

The grep command can be used to filter running processes according to their name, binary, or path. In the following example, we filter gnome-related processes.

$ ps aux | grep gnome

Kill Process with kill Command

The kill command is the defacto command in order to kill a process in Ubuntu. The kill command accepts the PId (Process ID) as the parameter.

$ kill 1550

If the process is owned by another or, a root user the sudo should be used to kill this process like below.

$ sudo kill 1550

Kill Process with pkill Command

The pkill command is an alternative way to kill a process. It provides the grep-like functionality where instead of the PID the process name is provided as a parameter. All matched processes are killed. In the following example, we kill all processes whose name contains “gnome”. Keep in mind that the pkill command kills all name-matched processes, not a single process.

$ pkill gnome

With root privileges use the sudo like below.

$ sudo pkill gnome

Kill Process with killall Command

The killall command is very similar to the pkill and used the same way to kill all processes for the specified name.

$ killall gnome

Kill Process with System Monitor (Task Manager)

Ubuntu provides the System Monitor which is used as Task Manager . The System Monitor can be used to list currently running processes and kill specific processes via the Graphical User Interface First open the System Monitor and then right-click on the process you want to kill. The last step is selecting the Kill from the context menu like below.

Kill Process with System Monitor (Task Manager)
See also  How To Install Vim On Ubuntu?

Leave a Comment