Home | Hardware | Internet News |Web Hosting |IT Management |Network Storage
LinuxPlanet
Search 
  Power Search | Tips 

 Front Door
 Discussion
 LinuxEngine
 Opinions
 Reports
 Reviews
 Tutorials
 News
 Technology Jobs

 Browse by subject.
Free Newsletter

Linux Planet
Linux Today
More Free Newsletters

Be a Commerce Partner


















internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

Print this article
Email this article

   LinuxPlanet / Tips







Ways to 'kill' With Linux
To kill or not to kill

Juliet Kemp
Thursday, January 8, 2009 04:24:37 PM

Juliet Kemp
... other than what its name implies.

kill is most often used without an argument or with -9, to kill a process off. But it can also be used to send various other signals to a process. Some are variations on process termination, but you can also get information about or out of processes.

  • kill -0 pid: This doesn't actually kill the process, just returns 0 (success) if the process exists and 1 (failure) if not. The command itself will not give you any output — you have to look at the exit code, using echo $? to get the information. So as a one-liner:
    kill -0 1685; echo $?
    will output 0 if process 1685 exists, and 1 if it doesn't. This can also be useful in shell scripts if you have a process number recorded and wish to check if it's still running.
  • kill -9 pid: You probably already know that you can terminate the process WITH EXTREME PREJUDICE. kill -KILL does the same thing and has the advantage of looking more vicious. The downside is that it is an extra couple of characters to type.
  • kill -HUP pid: Restarts the process.
  • kill -INT pid: Another way of killing the process, this time by interrupting it. It is a useful halfway house between kill and kill -9.
  • kill -ABRT pid: Stops your program and gets it to dump core if possible/appropriate. (kill -6 is a synonym.) This can be useful if a process is misbehaving, as it means that you may get debug information.





Linux is a trademark of Linus Torvalds.


internet.com home | search | help! | about us

Jupiter Online Media

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers