DirectNET

Data Center Management Solutions including UPS Systems, Data Center Cooling, KVM over IP & IP Power Strips, Server Racks and Server Rack accessories; KVM Switches and KVM Extenders; Rackmount Monitors and Rackmount Keyboards.


NAVIGATION
Home
Store
INSIDE MAC
Television Shows
Broadcast Shows
Daily News Shows
Special Shows
EVENTS
DAILY TIPS
Design
Mac OS X
Mac OS X UNIX
COMMUNITY
Surveys
NEWS
Current
Press
Archive
FEATURES
Editorial
Dr. Mac
Reviews
Reader Reports
RESOURCES
FAQ
Documentation
Learning Center
MAN pages
Glossary
Tutorials
Tips
Links

OUR PARTNERS

OSXFAQ Mac OS X UNIX Tip-of-the-Day   back to index

Week 100 - Trouble-Shooting (28 February 2005)

by Adrian Mayo - Editor, OSXFAQ

Tuesday - Force-Quit

Use 'kill' or 'killall' to force-quit errant applications.

The 'kill' command requires a process ID, not an application name. Discover it with:

$ ps xc | grep -iw ical
 6577  ??  S      0:41.67 iCal

(Put the application name in quotes if it contains spaces or characters special to the shell.)

Quit it with:

$ kill -QUIT 6577

Force-quit it with:

$ kill -KILL 6577

Do it on one line by creating a bash function:

$ function killer () { kill -KILL $(ps xc | grep -wi "$*" | awk '{print $1}'); }

$ killer ical

Kill applications belonging to other users. Add option 'a' to the 'ps' command so it lists processes owned by other users too. You must either be root or use 'sudo' to issue the 'kill' command.

Kill a process by name. Use the 'killall' command.

$ killall ical
No matching processes belonging to you were found

$ killall iCal

(Killall is case-sensitive.)

Killall can match process names by regular expressions too - check out the man page.

To shut down the computer from the command line:

$ sudo shutdown -r now

Discuss this trick in the Learning Center forum


If you want to learn more about Mac OS X Unix visit the Learning Center  click.

  • For beginners: Mac OS X Unix Tutorials
  • For detailed information on specific topics: Advanced Unix
  • For OS X in gereral: Mac OS X Tutorials

Copyright © 2000-2010 Inside Mac Media, Inc. All rights reserved.
Apple assumes no responsibility with regard to the selection, performance, or use of the products or services. All understandings, agreements, or warranties, if any, take place directly between the vendors and prospective users.
Apple, the Apple logo, Mac, PowerMac G4, PowerMac G5, Xserve, Xserve RAID, PowerBook, iBook, Airport, AirPort Extreme, iMac, eMac, iLife, iMovie, iCal, iPhoto, iTunes, QuickTime, FireWire, iPod, iSight, AppleWorks, Macintosh, Jaguar, Panther, Mac OS, Mac OS X and Mac OS X Server are trademarks of Apple Computer, Inc.