• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to kill a process  RSS feed

 
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI, could someone tell me how to kill a process on linux. Do anyone know a good and free tutorial??? thanks really,really!
 
Saloon Keeper
Posts: 18800
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Carefully!
The man or info commands can tell you about killing processes. Type "info killall" (or "man killall") for a good start, then use info (or man) to look at the programs listed in the "SEE ALSO" list at the bottom of the help page.
One good way to kill processes is to use the "top" program ("info top"). For one thing, top shows the resource usage of tasks in the system so you can both looks at what might be wrong and use the top program to send a kill signal. Type "?" while running top for more help.
kill actually just sends a signal to a task. Unix/Linux have lots of signals. The default one is the TERM signal. A runaway app may not honor TERM, however. "kill 9" is a much more forceful signal, but I recommend avoiding it unless milder methods fail. It may bypass the program's internal cleanup routines.
The "ps" program can be used to list the processes that are running and the process IDs (or "pid"s) that are used to tell kill which process to signal. Most times if you kill the parent process, its children will be removed as well.
As I mentioned "kill" isn't really a program that directly kills processes. It just sends a signal. This is why you may see programs - especially daemon programs - using kill for nonfatal purposes. For example "kill -HUP `/sbin/pidof smbd`" would send the HUP signal to the Samba daemon, causing it to reread the samba config file(s) after they had been changed.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!