Invoking the Shell

The command interpreter for the Bash shell (bash) can be invoked as follows:

bash [options] [arguments]

Bash can execute commands from a terminal, from a file (when the first argument is an executable script), or from standard input (if no arguments remain or if -s is specified). Bash automatically prints prompts if standard input is a terminal, or if -i is given on the command line.

On Linux systems, /bin/sh is generally a link to Bash. When invoked as sh, Bash acts more like the traditional Bourne shell: Login shells read /etc/profile and ~/.profile, and regular shells read $ENV, if it’s set. Full details are available on the bash manpage.

Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.