How to Kill a Process in Linux

How to Kill a Process in Linux

Process is a program or task that is currently running on your system. For example, when you open or run Mozilla Firefox on your system, a process is created. In other words, whatever you run, the system creates a process for it which you can see using the ps command.

During the task execution, you may be required to kill a process because the process may be stuck or consume more resources.

This tutorial focuses on methods to kill a process in Linux. We have used Red Hat Enterprise Linux 9 for demonstration.

How to kill a process in Linux?

You can terminate or kill a process using the kill command. It has the following syntax:

kill [OPTIONS] [PID]. . .

There are following three signals that are sent to the processes when a kill command is invoked with these options.

  • 1 – Reload a process
  • 9 – kill a process
  • 15 – Gracefully stop the process

Suppose you want to kill a process of Mozilla Firefox. For that, you need to identify its PID. You can us ps or top command.

After identifying the PID (which is 4740 in our case), you would run:

kill -9 4740

How to kill multiple processes in Linux?

You can kill multiple processes in Linux with just a single command. Suppose the three PIDs are 3443, 4567, and 3272. You would run:

kill -9 3443 4567 3272

Conclusion

That’s it. If you have any problem or feedback, get in touch with us using comments.