How do i find and kill a process in ubuntu

How do I find and kill a process in Ubuntu

One or more of your programs or processes may hang from time to time while using Ubuntu. In this situation, you find yourself looking for methods to conveniently, quickly, and safely halt the unresponsive processes and applications because restarting your system is not always the best solution. This article will show you how I find and kill a process in Ubuntu using both the command line and Ubuntu User Interface. Before jumping into that, firstly, we will check out a brief introduction of a process:

What is a process in Ubuntu

A process is a series of steps that must be followed to complete a particular task or we can say that it is a program that performs some operation. Multiple processes are frequently running simultaneously where one process is linked to a single program, and each process has its own set of components that perform specific tasks. A process has its own set of characteristics: Process Number (PID), Process Name, Unique Process Number, Process State, Process Origin, and Time, which each process takes.

Sponsored

When you execute an application, it starts running a background process. You can kill the process associated with this application by forcing the application to be closed. The next section will demonstrate how to find and kill a process using the Ubuntu terminal. So let’s get started!

How to find and kill a process in Ubuntu using terminal

Ubuntu has a utility called “ ps “ for displaying information associated with the processes on a system, which is an acronym for “Process Status“. The ps command is utilized for displaying a list of presently running processes, their PIDs, and other information. Following is the list of process attributes that will be fetched by executing the “ps” command:

See also  Podcast: Data in AI
  • PID (Process Identifier): In a system, each process is given a PID, a unique identifier for each running process.
  • %CPU: It is the consumed time divided by process execution time.
  • %MEM: It shows the ratio between the resident set the size of a process to the physical memory on the machine.
  • VSZ: This attribute displays the usage of virtual memory by a process.
  • RSS: RSS represents the ratio between Resident set size and the non-swapped physical memory.
  • TTY: It gives information about the controlling terminal associated with the process.
  • START: It displays the process start time.
  • TIME: To know about the total CPU usage, check out the TIME value.
  • CMD: This attribute shows the command executed by the process.

Now, write out the below-given command to find a process and its related information in the Ubuntu terminal:

$ ps ux

The execution of this command will show you the following output:

On your terminal, now you have all information related to processes. Search for a specific process. To kill a process, utilize its process ID in the “kill” command as follows:

$ kill -9 [PID]

In the above-given command, “-9” sends the kill signal “SIGKILL” to stop the process immediately. Now, we will try to kill the process of having “2051” PID in the following way:

$ kill -9 2051

The error-free output declares that the process having PID=2051 is successfully killed. To confirm the killed operation, again execute the “ps” command:

See also  Stellarium 23.4 Added Lens Distortion Estimator Plugin, Tibetan Lunar Mansions
$ ps ux

You can see that the killed process with PID 2051 is not in the retrieve processes list:

How to find and kill multiple processes in Ubuntu using terminal

You can also utilize the “kill” command for killing multiple processes at once. For instance, we want to kill the processes with PIDs: 1770, 1772, 1774, which are also highlighted in the below-given image:

To kill these multiple processes simultaneously, in the “kill” command, write out their PIDs in the following way:

Sponsored
$ kill -9 1770 1772 1774

All done!

How to find and kill a process in Ubuntu using System Monitor

Using the Ubuntu terminal to kill the process is simple, but beginners may not feel comfortable doing so. However, an Ubuntu user can utilize the System Monitor application for this purpose. The System Monitor operates similarly to the Task Manager on the Windows system. It displays a list of all active processes on your computer and real-time information about RAM, CPU, and disk consumption. It also enables you to kill any process software that refuses to respond.

If you do not have a System monitor in your Ubuntu system, then write out the below-given command for its installation:

$ sudo apt-get install gnome-system-monitor

After completing the installation, search “System Monitor” in the application’s search bar:

Here, you can see the list of active processes on your system. Find the process that is not responding, or you want to kill by scrolling down the list:

You can kill a specific process by right-clicking on it, then from the context menu, select the “kill” option or press “CTRL+K”:

Confirm this operation by clicking the “Kill Process” button, highlighted in the below-given image:

That’s it. Your selected process is killed in your Ubuntu system.

Conclusion

Ubuntu provides you various tools to stay in control even when the running process stops responding. You can kill an unresponsive process using the Ubuntu terminal and System monitor. This article showed you how to find and kill a process in Ubuntu using the Ubuntu terminal and System monitor. According to our experience, using the terminal for killing a process is a better choice because GUI-based tools may not show the information related to running a hidden process.


Discover more from Ubuntu-Server.com

Subscribe to get the latest posts sent to your email.

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply