Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 02-24-2009, 11:22 PM   #1 (permalink)
Osiris's Avatar
 

Join Date: Jan 2005

Location: Kentucky

Posts: 32,087

Osiris is a jewel in the roughOsiris is a jewel in the roughOsiris is a jewel in the rough

Send a message via ICQ to Osiris Send a message via AIM to Osiris Send a message via MSN to Osiris Send a message via Yahoo to Osiris Send a message via Skype™ to Osiris
Default Linux Process Management: Command Line

Linux Process Management: Command Line

Previously I wrote about using GUI tools for Linux process management (Get To Know Linux: Process Management.) Both the GNOME and the KDE tools are outstanding, user-friendly solutions to an issue that can often become troublesome. But what if you are running a headless server? Or what happens if that runaway process is X Windows itself? What do you do? You open up a terminal window and issue a command. In this article you are going to learn just that, killing rogue processes by command line.
Although you might think this a system of process management that should be avoided by the new user, you should consider that there may be times when knowing this process can really save your skin. So, although you may tend to shy away from the command line tools, this would be one of those that is good to know in a pinch.
The Commands
The first thing you have to understand is the commands you will be using. There are two commands that are useful: kill and killall. The kill command is used in conjunction with a process ID (PID) and the killall command is used in conjunction with command names. Your first reaction is most likely “How do I get the PID of an application?” Well, that will take another command.
Learn By Example
Let’s use Firefox as an example. Say, for some reason, Firefox has frozen and you can not get it to respond. Open up a terminal and issue the command killall firefox if that doesn’t kill Firefox then Firefox was started with a different command. To find out what that command is you could employ the ps command like so:
ps aux|grep firefox
The output would look something like:
[jlwallen ~]$ ps aux|grep firefox
jlwallen 10199 3.8 28.8 417396 223764 ? RNsl Feb23 77:22 /usr/lib/mozilla/firefox-bin -a firefox
jlwallen 13434 0.0 0.0 3796 688 pts/0 RN+ 20:14 0:00 grep firefox
You see the line that includes firefox-bin? That is most like what you need to kill. So issue the command killall firefox-bin and the frozen Firefox will go away.
If you look up at the command output again you can see the output includes the PID of each command. The PID associated with firefox-bin would be 10199. You could issue the command kill 10199 and Firefox would close as well.
Frozen X
What if X Windows freezes and you know the culprit was, say, Evolution? You can’t get to a terminal window so what do you do? You have to go to a different virtual console. To do this you will hit the key combination Ctrl-Alt-F* (Where * is a number 1-9. This number will differ depending upon which virtual console X is running.) Once you are in a virtual consol you will have to log in as your user and then issue the kill command. You can then go back to the virtual console running X and, hopefully, it will be back under your control.
Final Thoughts
It’s not as user-friendly as either the GNOME or KDE tools, but this method is a very valuable method of process control. Some day you will need to have this method in your tool belt and, when you do, you’ll be glad you have it.
__________________
Osiris is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get To Know Linux: Process Management Osiris Linux Tips and Tricks 0 02-23-2009 07:30 PM
Linux Software: Backup Solutions Osiris Linux Tips and Tricks 3 07-25-2008 01:04 AM
New with Linux MindHacked Linux, BSD, other *nixes & Open Source Software 8 04-16-2008 09:18 PM
Issue with BF2 on my E510 dykzeulb PC Gaming 8 10-21-2007 04:26 PM
Want to make the move to Linux for good...advice? BoysNightOut Linux, BSD, other *nixes & Open Source Software 25 05-16-2007 11:40 AM