Advance

How To Find And Kill Running Processes In Linux

How to Find and Kill Running Processes in Linux

A Linux system administrator needs to know some Linux commands. In this article, you will learn How To Find And Kill Running Processes In Linux. In fact, Process management is one of the important aspects of System Administration in Linux, and it includes the killing of processes using the kill command. Additionally, sometimes administrators need to handle processes. To use this guide, try to purchase and use VPS or Linux web hosting.

 

 

 

How to Find And Kill Running Processes In Linux

Join us with this article to look at the killing of less productive or unwanted processes on your Linux system. In case you are a beginner, read our article on 10 useful Linux command Line tricks for Newbies.

 

Recommended Article: Tutorial Setup private DNS server on centos 8/7

 

What Is A Process In Linux?

A process on a Linux system can be a running occurrence of an application or program. You can also refer to processes as tasks executing in the operating system.

When a process is running, it keeps on shifting from one state to another and a process can in one of the following states:

 

Running: meaning the process is either executing or it is just set to be executed.

Waiting: meaning that the process is waiting for an event or for a system resource to carry out a task.

 

There are two types of waiting for processes under Linux namely interruptible and uninterruptible.

 

A waiting process that can be interrupted by signals is called Interruptible while awaiting a process that is directly waiting on hardware conditions and cannot be interrupted under any conditions is called uninterruptible.

 

Stopped: meaning that the process has been stopped, using a signal.

Zombie: meaning the process has been stopped abruptly and is dead.

 

When killing processes, the kill command is used to send a named signal to a named process or group of processes. The default signal is the TERM signal.

Remember that the kill command can be a built-in function in many modern shells or external located at /bin/kill.

 

 

 

Finding Process PID In Linux

In Linux, every process on a system has a PID (Process Identification Number) which can be used to kill the process.

You can identify the PID of any process by using the pidof command as follows:

pidof firefox
pidof chrome
pidof gimp-2.8              

Killing Processes In Linux

Once you find the process PID, let us now look at how to kill processes. In this first example, I am going to get the PID of the process and then send a signal to it.

I want to kill gimp process, so I will do it as follows:

pidof gimp-2.8
kill 9378

To verify that the process has been killed, run the pidof command and you will not be able to view the PID.

pidof gimp-2.8

You can also send a named signal to the process by using the signal name or numbers as follows:

pidof vlc
kill -SIGTERM 9541
pidof vlc    

Using the signal number to kill a process:

pidof banshee
kill -9 9647
pidof banshee            

Killing Multiple Process PID’s In Linux

To kill more than one process, pass the PID(s) to the kill command as follows:

pidof gimp-2.8
pidof vlc
pidof banshee
kill -9 9734 9747 9762

 

 

Conclusion

In this article, you have learned How to Find and Kill Running Processes in Linux. There are many other ways of killing processes in Linux, these few examples just help to give you an overview of killing processes. Linux commands subject is like an ocean that if you dive in it, it is endless. Find more articles and study Linux commands to be an expert.

We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.
  • Dylan Grace
    Dylan Grace
    6 months ago

    That’s it! Could you please tell me how can I kill a process running as a different user?

    Reply
    • Dani
      Dani
      6 months ago

      Sure, you should use sudo and type the command below:
      sudo killall firefox

      Reply
  • Javier Croker
    Javier Croker
    6 months ago

    Many thanks. What processes can we kill?

    Reply
    • Dani
      Dani
      6 months ago

      A normal user could kill just his own processes but a root user is able to kill all processes. So, if you need to be in the second group, add sudo before any command to run it as root.

      Reply
  • Sophia Kapila
    Sophia Kapila
    6 months ago

    Thanks. Is it possible to get a list of process?

    Reply
    • Dani
      Dani
      6 months ago

      Run the following command to do this:
      ps aux
      To explain more:
      a: is foe showing processes for all users.
      u: is for displaying the user who is using the process.
      x: is for showing all processes.

      Reply
  • Russel Arama
    Russel Arama
    6 months ago

    but how about locating the process to kill

    Reply
    • Dani
      Dani
      6 months ago

      If you need to kill a process, first locate the details of the process. Here are the commands you can use to do this:
      top, ps, pidof and pgrep.
      Check the situation and use one of the above commands.

      Reply
  • Tom Johnson
    Tom Johnson
    6 months ago

    Hi, what does process mean basically in Linux?

    Reply
    • Dani
      Dani
      6 months ago

      Hi, since there are programs running by user and OS in an operating system, the programs which are running on the system are called ‘’processes’’. Also, you would see that a process terminates on its own when they’re done with their task, or when you ask them to quit by pressing a keyboard shortcut or clicking on the “Close” button.

      Reply

Leave Your Comment

Your email address will not be published.

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+18054214518

7 days a week, 24 hours a day