Skip to Content
Learning Unix for Mac OS X Panther
book

Learning Unix for Mac OS X Panther

by Dave Taylor, Brian Jepson
December 2003
Beginner to intermediate
192 pages
5h 7m
English
O'Reilly Media, Inc.
Content preview from Learning Unix for Mac OS X Panther

Canceling a Process

You may decide that you shouldn’t have put a process in the background or the process is taking too long to execute. You can cancel a background process if you know its process ID.

Tip

Mac OS X includes a very helpful utility called Force Quit, accessible from the Apple menu, which can be quite useful when applications are stuck or nonresponsive. However, commands entered into the Terminal window can only be cancelled from the command line—they don’t show up in Force Quit. In addition, Force Quit doesn’t show you administrative processes. To stop Unix programs and administrative processes, you must use the command line or the Activity Monitor.

kill

The kill command terminates a process. This has the same result as using the Finder’s Force Quit command. The kill command’s format is:

kill PID(s)

kill terminates the designated process IDs (shown under the PID heading in the ps listing). If you do not know the process ID, do a ps first to display the status of your processes.

In the following example, the sleep n command simply causes a process to “go to sleep” for n seconds. We enter two commands, sleep and who, on the same line, as a background process.

$ (sleep 60;who) &
[1] 472
$ ps
  PID  TT  STAT      TIME COMMAND
  347 std  S      0:00.36 -bash
  472 std  S      0:00.00 -bash
  473 std  S      0:00.01 sleep 60
$ kill 473
$ -bash: line 53:   473 Terminated              sleep 60
taylor   console  Sep 24 22:38 
taylor   ttyp1    Sep 24 22:40 

[1]+  Done                    ( sleep 60; who )
$

We decided that 60 seconds was too long to wait ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Fuzzy Set and Its Extension

Fuzzy Set and Its Extension

Tamalika Chaira
How to coach with NLP

How to coach with NLP

Robbie Steinhouse
How to Develop a Great Digital Strategy

How to Develop a Great Digital Strategy

Jeanne W. Ross, Cynthia M. Beath, Ina M. Sebastian

Publisher Resources

ISBN: 0596006179