Previous Table of Contents Next


Shell Built-In Commands

The (K) in the Bourne or Korn Shell column indicates commands that are available only with the Korn shell.

Purpose Bourne or Korn Shell C Shell
Null command : :
Create a command name alias alias (K) alias
Run current command in background bg (K) bg
Exit enclosing for or while loop break break
Break out of a switch breaksw
Change directory cd cd
Continue next iteration of for or while loop continue continue
Default case in switch N/A default
Print directory stack N/A dirs
Write arguments on STDOUT echo, print (K) echo
Evaluate and execute arguments eval eval
Execute the arguments exec exec
Return or set shell variables set @
Exit shell program exit exit
Create an environment variable export setenv
Bring a command into foreground fg (K) fg
Execute foreach loop for foreach
Perform filename expansion N/A glob
Go to label within shell program N/A goto
Display history list fc (K) history
If-then-else decision if if
List active jobs jobs (K) jobs
Send a signal kill kill
Set limits for a job's resource use ulimit limit
Terminate login shell and invoke login N/A login
Terminate a login shell exit logout
Change to a new user group newgrp N/A
Change priority of a command N/A nice
Ignore hangup N/A nohup
Notify user when job status changes N/A notify
Control shell processing on receipt of a signal trap onintr
Pop the directory stack N/A popd
Push a directory onto the stack N/A pushd
Read a line from stdin read $<
Change a variable to read-only readonly N/A
Repeat a command n times repeat
Set shell environment variables = setenv
Set a local C shell variable set
Shift positional parameters $* or $argv shift shift
Read and execute a file .(dot) source
Stop a background process N/A stop
Stop the shell suspend (K) suspend
CASE statement case switch
Evaluate conditional expressions test N/A
Display execution times times time
Set default security for creation of files and directories umask umask
Discard aliases unalias (K) unalias
Remove limitations on resources ulimit unlimit
Unset a variable unset unset
Unset an environment variable N?A unsetenv
UNTIL loop until N/A
Wait for background process to complete wait N/A
WHILE loop foreground while while

Bourne and Korn Shell Redirection

Description Command
Take standard input from file <file, or 0<file
Redirect STDOUT to file > file, or 1>file
Redirect STDERR to file 2>file
Append STDOUT to file >> file
Redirect STDERR to stdout 2>&1
Pipe standard output of cmd1 as standard input tocmd2 cmd1|cmd2
Use file as both STDIN and STDOUT <> file
Close STDIN <&-
Close STDOUT >&-

C Shell Redirection Metacharacters

Description Command
Redirect STDOUT to file >file
Take input from file <file
Append STDOUT to end of file >>file
Redirect STDOUT and STDERR to file >&file
Append STDOUT and STDERR to file >>&file
Close STDERR 27&-


Previous Table of Contents Next