WebProWire.com
TechnologySearchAdvertisingSocialFinancialLegal
Latest News on: WebProWire.com

Pocket Wikipedia Does Info on the... AppScout
Verizon CEO hates on Steve Jobs,... Engadget
eBay Ordered To Pay For Fake... PSFK
Sirius Charts Goals From XM Tie-Up Wall Street Journal
Attending SMX Local-Mobile? Screenwerk


Recent Articles

On A Linux System Everything Is A File
A Linux system, just like any *NIX based system doesn't differentiate between a file and a directory, since a directory is just another file which contains names...

A Guide To Linux Communities
Are you a new Linux user? Fantastic! Welcome to the world of freedom. Freedom of choice, freedom of expression, freedom from vendor lockin. You've made...

Adobe AIR Ready For Linux
Adobe AIR for Linux Alpha-Release is available on Adobe Labs. It is a pre-release version and is alpha-ish at best. About a month earlier, Adobe shipped AIR v1.0...

Linux-Based Everex GPC Pulled From Wal-Mart Shelves
Price-wise, we think a $200 PC is hard to beat. Wal-Mart (and/or the store's customers) apparently found fault with something, however, as the company has decided to dedicate its shelf space to something else.

Moving a Subversion Repository from Windows...
I recently had to move a subversion (svn) repository to another server. The repository was on a Windows server and had to be moved to a Linux server.


07.01.08

Methods To Terminate A Process On Linux

By Praval Singh

In our previous article - Sharpen your Linux vocabulary - we visualized few commonly used terms in context with the Linuxoperating system and its surroundings! I thank and appreciate the readers foradding on a few more words.

While I was figuring out a way to run Internet using a CDMA wireless modem onmy Linux machine, one of the applications refused to respond due to some rareerror. This very incident reminded me to come up with following article whichelaborates few methods to help you terminate a process or application running ona Linux distribution - something similar to 'end task' on a windows operatingsystem.

Remember, there is no Ctrl+Alt+Del key combination on Linux - by default!

Let us now see some of the interesting ways to kill those stuck and stubbornprocesses. A very mundane and primitive way is to use the command ps aux, look through the process list until you find the PID (process ID) you want and issue the kill command.

Alternatively, a better way is to use the 'killall' command which would automatically kill a program based on its name.

# killall mozilla-bin

There may be times when you shall only know a part of the name. In such ascenario, you can combine ps with grep, kill and awk to produce something like this.

# ps aux | grep mozilla | awk '{print $2}' | xargs kill

Now if that was tedious, there are still simpler ways. Enter pkill and theclosely related pgrep. All these commands are part of the sys-apps/procpspackage and are specifically designed to search for or kill running processes. The previous command could be replaced with the following:

# pkill mozilla


If you just need to list the PID's instead of killing them, you may just usepgrep.

Lastly, if you have a runaway process hogging /dev/dsp, or some other file orsocket, you can use fuser, which displays the PID's of process using a specified file or filesystem. You can give it the -k option and can easily kill those processes:

# fuser -k /dev/dsp

Now with the power of these commands, you shall never have the problem of 'killing' or stopping a process which you are unable to do otherwise.

Remember a fact that Linux has a lot of features which may not be evident bydefault or on the first look. But the depth it has considering the underlyingarchitecture and a strong command line integration is simply superb. I wouldadvise you to look out for a few HOW-TO's, hang around in the IRC's andparticipate in the discussions at various Linux forums - either as an audienceor a contributor.

More than an operating system Linux is a large community and strongrelationship between its members. A relationship of sharing knowledge andreusing it, unlike reinventing the wheel!

Comments


About the Author:
Praval Singh is a contributing writer for Brajeshwar.com.
LinuxProNews is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
LinuxProNews.com WirelessProNews.com
CProgrammingTrends.com DevWebPro.com


About LinuxProNews
LinuxProNews is a collection of news and commentary designed to keep you in step with the ever evolving landscape of Linux environments. Opensource News and Advice for Linux Professionals




-- LinuxProNews is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2008 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal

archives | advertising info | news headlines | free newsletters | comments/feedback | submit article



Opensource News and Advice for Linux Professionals LinuxProNews News Archives About Us Feedback LinuxProNews Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact