kill processes in Linux it is very simple, and so far there are four ways that we will talk about next.

Is killing processes in Linux easy?

Linux is one of the best operating systems that currently exists, and it is that, in addition to having incredible tools, it also includes others that help to end some processes that have malfunctions.

There are four ways in which you can kill processes on Linux easily, and each of them has its advantages. For this reason, we will mention them below:

Kill: Kill the process using the PID

The first thing to keep in mind is the PID and to get it on Linux, you just type the command "". Afterwards, a list appears where you can see all the processes that are available with their PIDs.

Now, for many people this is usually a somewhat complicated way to end the processes, however, it depends on each user.

Kill is responsible for sending different signals to kill a process in Linux, or even a group of them. The sign that characterizes it is »TERM», in case it is not specific. However, it also includes three variants, and they are the following:

  • FOLLOW UP: This signal is used when the console does not respond, or you do not have any type of control in the process.
  • SIGKILL: It is considered the most radical signal to kill a process, and it is used specifically when it no longer responds in any way. What worries users is that no information is saved.
  • SIGTERM: It is the most recommended, and even the most used to end a process.
  • Others: You can also use the signs that appear in the following image:
kill processes

To understand this alternative a little better, we leave you an example where the PID of the process is "73544", and no signal type is specified, therefore, it is understood that it must be SIGTERM.

  • Taking into account the above, you must coocar "Kill + SIGTERM + 735544"
  • Remember that it is important that the PID is replaced by the one that corresponds to each process.

Killall: Terminate a process using its name

It is very easy to use, and the difference with the previous one is that the process is interrupted using its name.

It is very safe because it must be the exact name of the process, and not a pattern as occurs with another of the ways to terminate it. Another aspect that sets it apart is that it has the ability to terminate processing based on timestamps.

For example, in case you want to kill a specific process, which has been running for 20 minutes, you would write: killall -y 20m [process_name>]. You can also use other abbreviations, such as:

  • s-seconds.
  • m-minutes.
  • h-hours.
  • d-days.
  • w-weeks.
  • M-months.
  • y-years.

pkill: kill a process with only part of its name

It is considered as a variation of kill command, but, you have the possibility to use a part of the process name to kill it, or even a pattern. However, you must take into account that all processes that include the given word will be closed.

  • Once you are completely sure, you should write »pkill part_process_name», for the closure to take place.
  • For example, if you want to close Chorme browser, you should place »pkill chr», and the closing process will be carried out.

xkill: Kill the process in Linux only by selecting the window with the mouse

Of all those that have been mentioned throughout the article, this is the easiest to use and most practical. Because, you just have to press the keys Alt + F2, and immediately a box will appear on your screen.

That box is the one that gives you the option to write the command, and that it can be executed correctly. Therefore, continue to place »xkill» in the corresponding space.

You must be careful, because your mouse cursor is going to turn into a very small skull. And, finally, what you have to do is select the process you want to close and that's it.