Previous Table of Contents Next


Each shell also includes built-in commands for efficiency. Table 16-6 lists the built-in commands. The Bourne shell relies more on using external commands to do the work, and thus has the fewest built-in commands. The additional built-in commands for the Korn shell are shown by (K) following the command name. The job control variant of the Bourne shell, jsh, has the same job control features as the Korn shell.

Table 16-6 Shell Built-In Commands

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 N/A 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 N/A @
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 N/A logout
Change to a new user group newgrp (K) 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 N/A repeat
Set shell environment variables = setenv
Set a local C shell variable N/A 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 ... esac switch ... endsw
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 while while


CAUTION! Do not use any of the built-in commands as names for shell scripts. If you use one of the built-in commands as a shell script name, the shell will execute the built-in command instead of running the script.


Previous Table of Contents Next