home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Linux in a NutshellLinux in a NutshellSearch this book

8.9. Built-in Commands

history

history [options]

Display the list of history events. (History syntax is discussed earlier in Section 8.6.)

Options

-c
Clear history list.

-h
Print history list without event numbers.

-r
Print in reverse order; show oldest commands last.

n
Display only the last n history commands, instead of the number set by the history shell variable.

-L file
Load series of pushd and popd commands from file in order to re-create a saved stack.

-M file
Merge the current directory stack and the stack saved in file. Save both, sorted by time, in file as a series of pushd and popd commands.

-S file
Print to file a series of pushd and popd commands that can be invoked to replicate the stack.

-T
Print with timestamp.

Example

To save and execute the last five commands:

history -h 5 > do_it
source do_it
kill

kill [options] IDs

Terminate each specified process ID or job ID. You must own the process or be a privileged user. This built-in is similar to /bin/kill described in Chapter 3 but also allows symbolic job names. Stubborn processes can be killed using signal 9.

Options

-l
List the signal names. (Used by itself.)

-signal, -s signal
The signal number or name without the SIG prefix (e.g., HUP, not SIGHUP). The command kill -l prints a list of the available signal names. The list varies by system architecture; for a PC-based system, it looks like this:

% kill -l
HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV USR2
PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG 
XCPU XFSZ VTALRM PROF WINCH POLL PWR SYS RTMIN RTMIN+1
RTMIN+2 RTMIN+3 RTMAX-3 RTMAX-2 RTMAX-1 RTMAX

The signals and their numbers are defined in /usr/include/asm/signal.h; look in that file to find the signals that apply to your system.

Examples

If you've issued the following command:

44% nroff -ms report &

you can terminate it in any of the following ways:

45% kill 19536     Process ID
45% kill %         Current job
45% kill %1        Job number 1
45% kill %nr       Initial string
45% kill %?report  Matching string
nice

nice [+n] command

Change the execution priority for command or, if none is given, change priority for the current shell. (See also nice in Chapter 3.) The priority range is -20 to 20, with a default of 4. The range seems backward: -20 gives the highest priority (fastest execution); 20 gives the lowest. Only a privileged user may specify a negative number.

+n
Add n to the priority value (lower job priority).

-n
Subtract n from the priority value (raise job priority). Privileged users only.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.