|
OSXFAQ Mac OS X UNIX Tip-of-the-Day

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
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
|