Skip to Main Content
Learning Unix for Mac OS X, Second Edition
book

Learning Unix for Mac OS X, Second Edition

by Brian Jepson, Dave Taylor
December 2002
Beginner content levelBeginner
160 pages
4h 22m
English
O'Reilly Media, Inc.
Content preview from Learning Unix for Mac OS X, Second Edition

Checking on a Process

If a background process takes too long, or you change your mind and want to stop a process, you can check the status of the process and even cancel it.

ps

When you enter the command ps, you can see how long a process has been running, the process ID of the background process, and the terminal from which it was run. The tty program shows the name of the Terminal where it’s running; this is especially helpful when you’re logged into multiple terminals, as the following code shows:

% ps
  PID  TT  STAT      TIME COMMAND
  310 std  S      0:00.37 -tcsh (tcsh)
  510 std  R+     0:00.00 ps
  459  p2  S+     0:00.25 -tcsh (tcsh)
% tty
/dev/ttyp1

std corresponds to your current Terminal window, and p2 corresponds to the Terminal window for ttyp2. In its basic form, ps lists the following:

Process ID (PID)

A unique number assigned by Unix to the process.

Terminal name (TT)

The Unix name for the terminal from which the process was started.

Run time state (STAT)

The current state of each job. S is sleeping, R is runnable, T is stopped, and I is idle (sleeping for more than 20-30 seconds). Additionally, the state can include + to indicate it’s part of the foreground group process, E to indicate the process is exiting, and W to mean it’s swapped out.[12]

Run time (TIME)

The amount of computer time (in minutes and seconds) that the process has used.

COMMAND

The name of the process.

Each terminal window has its own terminal name. The previous code shows processes running on two windows: std ...

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.
Start your free trial

You might also like

Mac OS X for Absolute Beginners

Mac OS X for Absolute Beginners

Wallace Wang
JMP Connections

JMP Connections

John Wubbel
Using csh & tcsh

Using csh & tcsh

Paul DuBois

Publisher Resources

ISBN: 0596004702Catalog PageErrata