How to find and kill running processes in linux

Information TechnologyLinux

Do you think Linux computers will automatically handle process by itself? Sometimes administrators need to handle processes. Process management is one of the important aspects for Linux administrators. This article describes”How to find and kill running processes in Linux”.

Linux creates a process whenever a program is opened, either by the user or by Linux. This process contains information about “how a program is running”. When a process or application is opened , it keeps on changing from one state to another and it usually stays in either of the following states –

  • Running State – It means the process is executing or set to be executed.

  • Waiting State –It means the process is waiting for the system event.

The waiting process is interpreted by signals called as Interruptible and the waiting process is directly reflected on hardware condition called as Uninterruptible. The waiting/killing stages should be one of the following –

  • Stopped State – It means the process has been stopped by the signal.

  • Zombie State – It means the process has been stopped abruptly and is dead.

Finding Process PID

To find the process PID of application, use pidof  command as shown below –

$ pidof bash

The sample output should be like this –

$ pidof bash

Killing Process

To kill a process, use kill command as shown below-

$ kill 12627(process PID)

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

$ pidof vlc
$ kill -SIGTERM 14778
$ pidof vlc

Using the signal number to kill a process as shown below-

$ pidof vlc
$ kill -9 15046
$ pidof vlc

In the above command 9 is the signal number for the SIGKILL signal.

Killing Multiple Process PID’s

To kill multiple process PID’s, use the following process –

$ pidof firefox
$ pidof vlc
$ kill -9 15458 15117

Congratulations! Now, you know “How to Find and Kill Running Processes in Linux”. We’ll learn more about these types of commands in our next Linux post. Keep reading!

Published on 21-Oct-2019 10:17:13