Shell
bash
GNU Bourne-Again Shell — the most common default Linux shell.
Synopsis
syntax
bash [OPTION]... [FILE [ARG]...]
Examples
Run a script in bash
bash script.sh
Execute inline command
bash -c 'echo $SHELL'
Run with debug tracing
bash -x script.sh
Check script syntax without running
bash -n script.sh
Common options
| Flag | Description |
|---|---|
| -c | Execute commands from string |
| -x | Print commands before execution (debug) |
| -e | Exit on first error |
| -n | Check syntax without executing |
| --login | Act as login shell |
About bash
The `bash` command gNU Bourne-Again Shell — the most common default Linux shell. Shell commands configure your interactive environment — variables, aliases, history, and shell options.
The shell is your primary interface with Linux, and customizing it improves productivity. These commands work across bash, zsh, and other POSIX-compatible shells with minor differences.
The command accepts 5 commonly used flags shown above, though the full set of options is available in the man page (`man bash`). The 4 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.
Related commands
More Shell Commands
Other commands in the Shell category