: | Do-nothing command; returns exit status 0. |
. file | The dot command reads and executes a command from file. |
break | See "The break Command" on page 699. |
continue | See "The continue Command" on page 700. |
cd | Changes directory. |
echo [ args ] | Displays arguments. |
eval command | Shell scans the command line twice before execution. |
exec command | Runs command in place of this shell. |
exit [ n ] | Exit the shell with status n . |
export [ var ] | Makes var known to subshells. |
fc “e [ editor ] [ lnr ] first last | Used to edit commands in the history list. If no editor is specified, the value of FCEDIT is used; if FCEDIT is not set, /bin/ed is used. Usually history is aliased to fc “l . E XAMPLES |
fc “l | Lists the last 16 commands on the history list. |
fc “e emacs grep | Reads the last grep command into the emacs editor. |
fc 25 30 | Reads commands 25 through 30 into the editor specified in FCEDIT , by default the ed editor. |
fc “e “ | Re-executes the last command. |
fc “e “ Tom=Joe 28 | Replaces Tom with Joe in history command 28 . |
fg | Brings the last background job to the foreground. |
fg %n | Brings job number n to the foreground. Type jobs to find the correct job number. |
jobs [ “l] | Lists the active jobs by number and with the “l option by PID number. E XAMPLES $ jobs [3] + Running sleep 50& [1] Stopped vi [2] Running sleep% |
kill [ “signal process ] | Sends the signal to the PID number or job number of process. See /usr/include/sys/signal.h for a list of signals. S IGNALS |
SIGHUP1 /* hangup (disconnect) */ |
SIGINT 2 /* interrupt */ |
SIGQUIT 3 /* quit */ |
SIGILL 4 /* illegal instruction (not reset when caught) */ |
SIGTRAP 5 /* trace trap (not reset when caught) */ |
SIGIOT 6 /* IOT instruction */ |
SIGABRT 6 /* used by abort, replace SIGIOT in the future */ |
SIGEMT 7 /* EMT instruction */ |
SIGFPE 8 /* floating-point exception */ |
SIGKILL 9 /* kill (cannot be caught or ignored) */ |
SIGBUS 10 /* bus error */ |
SIGSEGV 11 /* segmentation violation */ |
SIGSYS 12 /* bad argument to system call */ |
SIGPIPE 13 /* write on a pipe with no one to read it */ |
SIGALRM 14 /* alarm clock */ |
SIGTERM 15 /* software termination signal from kill */ |
SIGURG 16 /* urgent condition on I/O channel */ |
SIGSTOP 17 /* sendable stop signal not from tty */ |
SIGTSTP 18 /* stop signal from tty */ |
SIGCONT 19 /* continue a stopped process */ |
| EXAMPLES (To use the kill command and a signal name , strip off the SIG prefix and precede the signal name with a dash.) kill INT %3 kill HUP 1256 kill 9 %3 kill %1 |
getopts | Used in shell scripts to parse command line and check for legal options. |
hash | Lists all tracked aliases. |
login [ username ] | |
newgrp [ arg ] | Changes your real group ID to the group ID. |
print “[nrRsup] | Replacement for echo . See print . |
pwd | Print present working directory. |
read [ var ] | Read line from standard input into variable var . |
readonly [ var ] | Make variable var readonly . Cannot be reset. |
return [ n ] | Exit value given to a function. |
set [ “aefhknoptuvx “ [ “o option] [ “A arrayname] [ arg ] ] | Examples |
set | Lists all variables and their values. |
set + | Lists all variables without their values. |
set “o | Lists all option settings. |
set a b c | Resets positional parameters $1 , $2 , $3 . |
set “s | Sorts $1 , $2 , and $3 alphabetically . |
set “o vi | Sets the vi option. |
set “xv | Turns on the xtrace and verbose options for debugging. |
set “ “ | Unsets all positional parameters. |
set “ “ "$x" | Sets $1 to the value of x , even if x is “x . |
set == $x | Does pathname expansion on each item in x and then sets the positional parameters to each item. |
set “A name tom dick harry name[0] is set to tom; name[1] is set to dick ; name[2] is set to harry . set +A name joe name[0] is reset to joe , the rest of the array is left alone; name[1] is dick ; name[2] is harry . |
(To set options, use the “o flag; to unset options, use the +o flag.) set “o ignoreeof |
Options: |
allexport | After setting this, exports any variable defined or changed. |
bgnice | Runs background jobs with a lesser priority; used instead of nice . |
emacs | Sets the emacs built-in editor. |
errexit | The shell exits when a command returns a nonzero exit status. |
gmacs | Sets the built-in gmacs editor. |
ignoreeof | Ignores the EOF (Ctrl-D) key from terminating the shell. Must use exit to exit. |
keyword | Adds keyword arguments occurring anywhere on the command line to the environment of the shell. |
markdirs | Puts a trailing backslash on all directory names resulting from filename expansion. |
monitor | Sets job control. |
noclobber | Prevents overwriting files using the redirection operator, > . Use > to force overwrite. |
noexec | Same as ksh “n ; reads commands but does not execute them. Used to check for syntax errors in shell scripts. |
noglob | Disables pathname expansion with ksh wildcard metacharacters. |
nolog | Function definitions will not be stored in the history file. |
nounset | Displays an error if a variable has not been set. |
privileged | Turns on privileged mode for setuid programs. |
trackall | Ksh causes each command to become a tracked alias; automatically turned on for interactive shells . |
verbose | Echos each line of input to standard error; useful in debugging. |
vi | Sets the vi built-in editor. |
viraw | Specifies vi character at a time input. |
xtrace | Expands each command and displays it in the PS4 prompt, with variables expanded. |
shift [ n ] | Shifts positional parameters to the left n times. |
times | Prints accumulated user and system times for processes run from this shell. |
trap [ arg ] [ n ] | When shell receives signal n (0, 1, 2, or 15), arg is executed. |
type [ command ] | Prints the type of command; for example, pwd is a built-in shell. In ksh , an alias for whence “v . |
typeset [ options ] [ var ] | Sets attributes and values for shell variables and functions. |
ulimit [ options size ] | Sets maximum limits on processes. E XAMPLES |
ulimit “a | Display all limits: Time (seconds) unlimited. File (blocks) unlimited. Data (kbytes) 524280. Stack (kbytes) 8192. Memory (kbytes) unlimited. Core dump (blocks) unlimited. |
| Other Options: |
| “c size | Limits core dumps to size blocks. |
| “d size | Limits the data size (of executables) to size blocks. |
| “f size | Limits the size of files to size blocks (default). |
| “m size | Limits the size of physical memory to size K bytes. |
| “s size | Limits the size of the stack area to size K bytes. |
| “t secs | Limits process execution time to secs seconds. |
umask [ mask ] | Without argument, prints out file creation mask for permissions. |
umask [ octal digits ] | User file creation mode mask for owner, group, and others. |
unset [ name ] | Unsets value of variable or function. |
wait [ pid#n ] | Waits for background process with PID number n and report termination status. |
whence [ command ] | Prints information about the command, like ucb whereis . E XAMPLES |
| whence “v happy | happy is a function |
| whence “v addon | addon is an undefined function |
| whence “v ls | ls is a tracked alias for /bin/ls |
| whence ls | /bin/ls |