How to kill linux process
Do you have a process on linux that you can not close?
You know when, on Windows, a program hangs and you have to open the task manager to force it to close? Here, this kind of thing does not happen only on the Microsoft home operating system: they also happen on operating systems generally considered more important; stable, like macOS and Linux, and it is just of these that I want to talk to you today.
To be more precise, & egrave; I want to talk to you about Linux, and I want to do this to illustrate some of the best techniques for "killare", that is; to end in a forced way, the processes that do not respond anymore. There are various ways to do this, and since you are only now taking your first steps in this extraordinary operating system, I suggest you try them all.
I will use Ubuntu, one of the most popular Linux distro; widespread in the world (to be exact Ubuntu 16.04 LTS), but the instructions in the tutorial are valid for many other versions of the penguin operating system. Courage, do not wait any longer: take five minutes of free time and discover how to kill a Linux process by following the instructions below. I assure you that it will be & agrave; really a breeze!
If you are familiar with Windows and its task manager, you will find the System Monitor interface very familiar, an application included as standard in Ubuntu (and other Linux distros) that allows you to view all processes running on your computer and & quot; kill & quot; those that do not respond anymore.
To use System Monitor, go to the Linux Dash (on Ubuntu just click on the Search on computer icon located in the left sidebar), look for System Monitor in the screen that opens and click on the icon of the utility that appears among the search results.
In the window that opens, find the process related to the program you want to & quot; kill & quot ;, select it with your mouse and click on the End Process button (located on the bottom left) and then on the End process in the confirmation window that appears in the center of the screen.
If the selected process, despite pressing the & quot; End Process & quot; button, does not close, right-click on its name and select the Kill item from the menu that appears. In this way you should be able to force the closing of the selected process (and therefore of the program).
Another very simple way to kill a Linux process is invoke the xkill command in the terminal. Using the xkill command, the mouse pointer changes to a small & quot; x & quot; and allows to & quot; kill & quot; a program by simply clicking on its window.
Come on, try it now! Open the terminal of Linux (if you do not know where it is, look for it in the Dash), type the xkill command in the window that opens and press the Enter
At this point, the mouse pointer should have turned into a & quot; x & quot; and the message Select the window whose client you wish to kill with button 1 . Then click on the window of the program you want to end and the related process should be & quot; killato & quot; instantly.
Finally, I want to show you some commands that let you kill Linux processes from the terminal. It is not about comfortable or intuitive solutions like those analyzed above, but it is always good to know them (even just to deepen their confidence with the Linux terminal).
In some cases, affinch & eacute; the commands are executed correctly, you must prefix the sudo to the latter and you must type the password as administrator.
Using the kill command You can terminate a process by simply indicating the ID, which is; the identification code.
- To find out the process identification code, open the terminal and type the command ps aux | grep name where instead of & quot; name & quot; you must enter the name of the program to be terminated. For example, to find all the processes related to LibreOffice you must type ps aux | grep libreoffice .
- To end the process, type the command kill ID , where instead of & quot; ID & quot; you must enter the process identification code from & quot; killare & quot; (eg kill 4818 to terminate the process with ID 4818).
With the pkill command you can & quot; kill & quot; all the processes that have a certain term in their name, without knowing the numerical ID.
For example, typing pkill firefox automatically terminates all processes that contain & quot; firefox & quot; in their name.
If you want to find out what processes contain a certain term in their name, type the command pgrep -l term , where instead of & quot; term & quot; you must type the term that must be present in the process name.
If you know the exact name of a process and want to & quot; kill it & quot; without going back to its numeric ID, use the killall name command, where instead of & quot; name & quot; you must type in the exact name of the process to be terminated (eg killall firefox to finish the process & quot; firefox & quot;).
To find out what processes are running on your computer, type the ps -ef command. If you want to find out what processes are performed by a specific user on your computer, use the command ps -ef | grep name , where instead of & quot; name & quot; you must type the name of the user who is the subject of the search.
Finally, I would like to point out that using the top command you can see which processes are using the most amount; resources (CPU and RAM) on the computer.
If you notice that your computer is going too slow, you can use the & quot; top & quot; to identify the processes responsible for slowing down the PC and the command & quot; killall & quot; to end it.