 Welcome back to another Linux quick tip today. I'm going to be showing you how to kill applications on Linux now The first thing that you need to understand about this is that it's not quite the same on every distro. It's mostly the same The reason why it's not quite universal is because it really does depend on what display server You're using now if you're using Ubuntu or Fedora and you're using them as they come out of the box you're probably using Wayland and The problem with Wayland is that it doesn't use the same tools as Xorg does now if all of that was gibberish to you I don't really blame you Really what it comes down to at the end of the day is that if you're using Ubuntu Vanilla Ubuntu or you're using the workstation version of Fedora or anything else that uses Wayland You're going to be following a slightly different playbook when it comes to killing processes and apps So I'm going to be going over the most Universal ways of killing applications today and I'll also show you how to do this in regular stock Fedora using Wayland So before we jump into the Wayland part of this Let's show the way to do this in the most Universal way for most people because most people still use Xorg So I'm here in BSPWM, which is a Xorg based window manager So there are three ways that you can kill applications in Most Linux distributions if you're using Xorg So the first way that I want to show you in the Xorg way of doing things is the application called Xkill now Xkill will basically allow you to kill any application as long as you're able to Interact with something else so as long as your computer is not completely frozen this should work So you what you want to do is open up a terminal and type in the Word Xkill now Xkill is installed on the vast majority of Linux distributions as long as they are Primarily Xorg focused so if you're on Fedora This is not going to come in pre-installed because it won't work in regular Fedora Now if you're using like the KDE spin or something like that you can install Xkill It's just not going to be there by default. So if you do end up having to install it It's usually packaged under the name Xkill. It's very easy to install It's in most repositories just install it and then run it just like this So you would hit enter and basically what this is going to do is it's going to tell you to select the window Who's client you wish to kill with button one basically? What that means is that it wants you to click on the window that you want to kill So in this case, I want to kill this particular window. It's just another terminal. I'm gonna click on it and There you go that particular application has now been killed. It's completely dead now That's my favorite way of killing processes on Linux It's just really simple because you go into a terminal type in Xkill You click on the program that's frozen or whatever and you're done now There are other ways to do it, but they're a little bit more complicated simply because you have to know the name of the applications so I'm going to open up Firefox here and the second way is To use a program called pkill now pkill Requires you to know the name of the application and when I say the name. I don't necessarily mean what the Program is called, but the package names. So in this case, I'm going to Guess that the package name of Firefox is actually Firefox So if I type in Firefox like this so and I enter Firefox is now killed now You might be able to see where This comes into being a problem if you don't know the name of the package This is not going to work now. There is a way if I open up Firefox again There is a way to Find out what the package name actually is so if we type in X prop and hit enter and then click on The application it will tell us what the name of the application is so in this case Firefox is the name of the application what you're looking for is Wm underscore class and that will allow you to Use pkill on that particular program now again This is only going to work if you're using X or X prop basically how you know something is X or X specific Usually it has an X at the beginning. That's usually a good rule of thumb so pkill is another way of doing it, but again, it requires you to Basically know what the name of the program is now Similarly that the third and the last one that I wanted to show you it also requires you to know the name So let's just say you had more than one Firefox open So I'm gonna open up actually another Firefox. I'm gonna take control and a couple of times now The thing is is that if you have multiple instances of a program open Sometimes they all have the same name. Sometimes they don't all have the same name and sometimes they're not even all frozen Really, it's gonna be a little bit confusing if you have multiple instances of a program open But you want to kill all of them. So the third way of Killing a program in Linux is actually the kill all command This will kill every instance of a program. So if I do kill all and then Firefox and Hit enter Firefox is now dead now You can see the advantages of this if you are only using one instance of a program P kill or X kill are going to be the best options for you simply because you can just click on it using X kill and it will go away in some instances X kill might even kill all the Instances, it's not guaranteed though kill all. However will for sure kill Everything when it comes to Firefox every process that Firefox is in control of it will kill all of them So if you need the nuclear option and something is really frozen kill all is probably your best option now That is the three ways you can kill processes and Applications when you're running an X org based system now if you're using Wayland There really isn't a fantastic way of killing something from the terminal So if you're a nerd and you prefer to kill stuff from the terminal, you're kind of out of luck I'm sure there's probably a way to do it I'm just actually never heard of it the best way to kill a process or an application on Wayland or in this case, you know anything based on Wayland is Using the process monitor So you want to go into your applications folder find system monitor here open that up Basically what this is doing is showing you all the processes and applications that are running on your system So let's open up a thing of Firefox here. Okay now that we have Firefox open We go back to our system monitor We hit the search button up the box the search box up here at the top and type in Firefox Now in some instances You're going to find that you don't actually have anything that's called Firefox in which case you're going to have to kind of Hunt and peck and the reason why I say that is because you never know which one of these you're going to kill That's actually going to end up killing Firefox because most of these are going to be individual tabs or some other process that Firefox has started Usually the one you can kind of count on being actually Firefox if you don't have actual Firefox here Is the one that's using the most memory? It's not always true. It's sometimes true In this case, we do have an instance of Firefox We'll just click on it and process and process again and Firefox has been killed now This is the process you can use if you're using a desktop environment of any kind It doesn't really have to be Wayland specific if you're using a KDE or XFC or budgie or whatever most of them come with some kind of system monitor or Something like that that allows you to see the running processes and all of them function basically the same so they have a list of processes and applications and You find the one you want to kill you click on it and you hit end process or kill perhaps if that's what they've used Whatever so it doesn't really mean that you have to be using something that is Wayland in order to do this It's really not that complicated if you're in a desktop environment of any kind whether using Wayland or XOR It doesn't really matter. You can do it in a GUI fashion like this I really wish I would have said that beforehand instead of focusing on Wayland because that's probably just going to confuse most of you So I apologize for that if you're using a desktop environment and you'd prefer to do it in a GUI You can do it in this fashion if you try the Xorg way Which I showed you in the beginning of this the video using the terminal commands and those don't work Even if you're in a desktop environment chances are you're probably in Wayland or some other situations going on Then you should use your graphical up system monitor or whatever to kill the process now The last thing I want to talk about is what happens if your entire system is Frozen and you can't get any of these things. Well, the answer to that question is pretty simple There's a power button on your computer press and hold that thing until your computer goes dark and start it back on if Linux freezes that's probably the best way to do it now You can if you want try to get into a TTY in which case you're going to want to send one of these buttons So usually control alt F3 is the best one That's usually the one that I use control alt F2 and F1 sometimes they're taken up with something else So control F3 will take you to a TTY, which is basically the underlying shell of your computer It asks you to log in and then you can try to kill whatever application is Killing you or freezing your computer you can try if that doesn't work You can also reboot from here so you could log in like so and then just do reboot like that And that would reboot your system even if it's been frozen now Like I said if you can't get to a TTY a hard reset with the power button is probably your only option So that is another quick tip on Linuxcast if you enjoyed this thing makes you hit the subscribe button You can follow me on Twitter, Mastodon, Odyssey, all those links will be in the video description below Thanks to everybody who supports me on patreon at patreon.com slash the Linuxcast Just like all these fine people. Thanks to everybody who does support me on Patreon YouTube You guys are all absolutely amazing. So thanks for that without you the channel This would not be anywhere near where it is right now. So thanks so very much. Thanks everybody for watching I'll see you next time