Kill: everything you need to know about this command for Unix

Kill for Ubuntu

Kill for Ubuntu

There are many people who, when we talk about using Linux, think that it is difficult because you have to use the Terminal for everything. This does not conform too much to reality, and less since we have the different application stores available. But it is true that the Terminal allows us to perform different tasks that, otherwise, would be much more difficult. Among them we have the command for Unix kill.

kill is a command that sends a completion signal. Its direct translation is "kill" and is practically what it does with the programs on which we run it. The command can be used in different ways, among which I would highlight, in Ubuntu and systems compatible with X Server, xkill. It's a command that I always want to have around, so I've created its own shortcut for it. Below we explain more about the command kill.

kill it will kill any open app we ask of it

Being a command, the most normal thing is that we use kill in a window of Port. We can kill an application using the command "pkill program" or "killall program". One that can fail me depending on what I want to run is Kodi, for which the examples would be like this:

pkill kodi

o:

killall kodi

If we want see all processes that are being executed from the terminal, we will write ps-ef o pgrep -l -u user if we want to see the processes that a specific user is using. If we want to access the terminal at any time, we will press Ctrl + Alt + T. This will be perfect when a program that runs in full screen hangs. Another option can be the "super" key, that is, the one that usually has the Windows logo on some computers. With this key we will see the Dock and we can open the Terminal. Of course, this will not be an option if that key does not exist. If a program hangs on full screen and does not let us exit, in the Kodi example we would press Ctrl + Alt + T and write killall kodi.

xkill, my favorite option

My favorite option is xkill. What he will do will be close X Server windows, but in another way: when executing the command, the cursor will turn into an X and we will have to click on a window of the rebel program. We must be careful when executing it, because once the cursor has been converted to X there is no going back until we click. It is a problem that I have suffered trying my shortcuts, that I execute it with nothing open and I have to click on the desktop or the Dock, for which I have to restart the program or the operating system.

How to create a shortcut for xkill

Very customizable systems like Ubuntu MATE

Xkill on Ubuntu MATE

Xkill on Ubuntu MATE

I use this command since I use Linux. I started with Ubuntu 6.04, an operating system that visually and functionally looks a lot like Ubuntu MATE. These operating systems have many customization options, among which are the bars at the top and the bottom. In these cases we only have to add a launcher with the command xkill and the icon that we want. We will achieve this by right clicking on the bar. Tip: move the icon away from other launchers so you don't accidentally activate it.

On systems like Ubuntu

Since Ubuntu uses Unity and now that it's back to GNOME, we can't add shortcuts like in Ubuntu MATE or drag our own shortcut to the Dock. As we explain in our article How to add a shortcut to Ubuntu 18.10From now on we will have to put the .desktop file in a specific path. We will create the .desktop file by opening a text sheet and typing the following:

[Desktop Entry]
Type = Application
Terminal = false
Name = Xkill
Icon = / home / pablinux / Pictures / death.png
Exec = xkill
GenericName [es_ES] = Kill application

From the previous text we will only have to change path to image (each user will put their path). We will save the file as .desktop, we will right click on it, we will give it permission to run as a program and we will put it in the folder ./local/share/applications which is inside our personal folder. If we don't see it, we'll press Ctrl + H to see the hidden files. Once there, we will go to our application menu and add it to our favorites so that it appears in the Dock. As I said before, it is best to put it all the way to the left to avoid accidents.

Creating a keyboard shortcut

[Updated] Another interesting option, perhaps the one that is the most, is create a keyboard shortcut. It is as simple as going to Settings / Keyboard shortcuts / Create new shortcut and indicate the order xkill. I now use Ctrl + Alt + M to make the X / skull appear at the pointer.

How to kill a program from the activity monitor

Kill program from Activity Monitor

Kill program from Activity Monitor

If you are one of those who have a Terminal allergy, you can always kill a program using activity monitor. It's in our app 'drawer' and the best way to run this method is to click on 'Process name' to sort them alphabetically, find the program, right-click on it, and choose 'Kill'. As you can see in the image, there are programs like Evolution that have more than one open process. We can kill just one and not the whole program. This can come in handy in programs like Chrome, which sometimes consumes a lot of memory and, if it hangs on a web, we can kill only one process.

Kill all the processes that we can kill

There is also a command to kill all the processes that we can kill. That command is the following:

kill -9 -1

You have to be careful with executing it, since will close it all. If we want to test it, we can do it when we go to turn off the computer. With this command we will close everything quickly and without asking us for confirmation. We must take into account what "everything" means, but we can summarize it by saying that it will close the session and, after a few seconds in which it seems that something has gone wrong, it will show us the login. We could say that it is practically like restarting the operating system. Programs that have configured that after a failure restart where it was will do so. Those that will not be reopened from the beginning, so it is a bad idea to test it if we are doing a moderately important task.

The command kill -9 -1 it is not a reboot to use, so it is not recommended to use it when a reboot is required, such as when updating the kernel of our operating system.

Have you had any questions about the command kill?


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.