From time to time, we get buggy programs that refuse to shut down, or just plain don’t want to work right, messing up the GUI and making our computing experience a drag. :( But the good news is that with the advent of Windows 95 came the Control, Alt, Delete function that magically enabled you to open up a task manager and close whatever process or program is giving you trouble. This force quits a program and lets you resume your computing session without rebooting your entire system. This sometimes works, this sometimes does not.
OK but now how about Linux? Does Linux have this magical Control, Alt Delete? Some Linux Distributions do, enabling it to bring up a task manager of some sort and kill some process. But what if you completely locked up the screen? Here let me show you an example. I tried running a desktop recording program on my 11.04 Linux Mint with a Gnome 3 desktop. Yes talk about custom. And it was messing with my desktop! just left me with a blank screen. So I wanted to force shut down the program. Here’s how I did it.
Step one: Get access to a terminal, if you can’t do it the usual way, like through the GUI cause it’s broken, press CTRL ALT F1 at the same time (No not now! Press CTRL ALT F8 or F7 to get back to the GUI) this will bring you to a login screen, if that one doesn’t work then try the F2 of F3. Almost all Linux distros I’ve tried have this function due to the fact that Linux is nativly a Multi-user system. Meaning you can log in as the same user or different users at the same time, without having to end some other user’s session. Windows has improved this since XP.
Step two: Log in as root, if you don’t know how to, log in as your regular user and add sudo to the follwing command.
Step three: top type: sudo top and type your admin password, then it will bring up the resources that are running, the ones with the heaviest cycles or more processes are at the top. the list moves so make sure you catch it. You can run this command as a regular user but you will not be able to kill anything without super user privileges. So let’s talk about TOP in more detail. (Let’s just say sudo means Admin for today)
top provides an ongoing look at processor activity in real time. It displays a listing of the most CPU-intensive tasks on the system, and can provide an interactive interface for manipulating processes. It can sort the tasks by CPU usage, memory usage and runtime. can be better configured than the standard top from the procps suite. Most features can either be selected by an interactive command or by specifying the feature in the personal or system-wide configuration file. See below for more information.
Thank you internet!
Now that you know something about it, then you will need to move onto step 4.
Step four: Find the process you want to Kill, yes Kill is the right word for it, once you find it, find the numbers that show up with like, like so.
See that 4 Digit Process ID #? Like for example, let’s say something crazy. Google Chrome has crashed and i need to force shut it down, I first find the PID and it’s 6816. Now i type K that stands for kill. Now I type the PID (just the #’s) 6816 and then it says something like. Kill PID 6915 with signal : press enter and wham! Your just killed your very first process, go hang it on the wall. But wait, now how do I get back to my nice and friendly desktop Environment? Umm try CTRL ALT F8, try all the F’s until you get your desktop back. If for some reason you can’t let’s go back to the terminal and type this in.
Step five: sudo restart gdm what this does is restart only the Gnome Display manager, works fine on most gnome desktops and some others that use GDM. So it’s like a mini-reboot when needed. I do this usually when games crash my system, and really they don’t crash the system per-se, it’s more like they crashed the GUI but the Linux kernel is running just fine. So sometimes only the GUI needs a reboot.
This stuff ain’t too hard, in fact TOP tool does more that kill processes like show you how much RAM you are really using and other useful stuff. http://linux.about.com/od/commands/l/blcmdl1_top.htm
here’s where i got the info from, so enjoy process hunting! And yes, Linux also comes with it’s own CTRL ALT DELETE. It’s just harder and cooler to use. Makes you feel smart. It’s a shame you don’t get to use it often.
PS> You can also use the free -m command to see how much RAM, your system is “really” using. So cool.