The Bash Hackers Wiki
This wiki is intended to hold documentation of any kind about GNU Bash. The main motivation was to provide human-readable documentation and information so users aren't forced to read every bit of the Bash manpage - which can be difficult to understand. However, the docs here are not meant as a newbie tutorial.
What would YOU like to see here? (outdated and locked, please use the discussions)
Scripting and general information
Bash syntax and operations
|Compound commands overview|
|command grouping in a subshell|
Expansions and substitutions
|Introduction to expansions and substitutions|
This is a selection of builtin commands and command-like keywords, loosely arranged by their common uses. These are provided directly by the shell, rather than invoked as standalone external commands.
| Declaration commands|
Commands that set and query attributes/types, and manipulate simple datastructures.
|declare||Display or set shell variables or functions along with attributes.|| ||builtin|
|export||Display or set shell variables, also giving them the export attribute.|| ||special builtin|
|eval||Evaluate arguments as shell code.||-||special builtin|
|local||Declare variables as having function local scope.||-||builtin|
|readonly||Mark variables or functions as read-only.|| ||special builtin|
|unset||Unset variables and functions.||-||special builtin|
|shift||Shift positional parameters||-||special builtin|
Commands for reading/parsing input, or producing/formatting output of standard streams.
|coproc||Co-processes: Run a compound command in the background with async I/O.||-||keyword|
|echo||Create output from arguments.||-||builtin|
|mapfile||Read lines of input into an array.|| ||builtin|
|read||Read input into variables or arrays, or split strings into fields using delimiters.||-||builtin|
| Configuration and Debugging|
Commands that modify shell behavior, change special options, assist in debugging.
|caller||Identify/print execution frames.||-||builtin|
|set||Set the positional parameters and/or set options that affect shell behaviour.||-||special builtin|
|shopt||set/get some bash-specific shell options.||-||builtin|
| Control flow and data processing|
Commands that operate on data and/or affect control flow.
|colon||"true" null command.||true||special builtin|
|dot||Source external files.||source||special builtin|
|false||Fail at doing nothing.||-||builtin|
|continue / break||continue with or break out of loops.||-||special builtin|
|let||Arithmetic evaluation simple command.||-||builtin|
|return||Return from a function with a specified exit status.||-||special builtin|
|[|| The classic ||test||builtin|
| Process and Job control|
Commands related to jobs, signals, process groups, subshells.
|exec||Replace the current shell process or set redirections.||-||special builtin|
|exit||Exit the shell.||-||special builtin|
|kill||Send a signal to specified process(es)||-||builtin|
|trap||Set signal handlers or output the current handlers.||-||special builtin|
|times||Display process times.||-||special builtin|
|wait||Wait for background jobs and asynchronous lists.||-||builtin|
previous alphabetical version
|caller||identify/print execution frames (Bash builtin)|
|coproc||Co-processes (Bash keyword)|
|declare||display or set shell variables or functions along with attributes (Bash builtin, synonym:
|exec||replace the shell, set redirections (Bash builtin)|
|let||arithmetic evaluation - an old fashioned way (Bash builtin)|
|mapfile||Mapping lines of input to an array, also named
|read||getting input from
|readonly||mark variables or functions as read-only (Bash builtin)|
|set||control positional parameters and shell behaviour (Bash builtin)|
|shopt||set/get shell options (Bash builtin)|
|unset||unset variables and functions (Bash builtin)|
Official Bash links
- Official Bash mailing lists:
- Official Bash git repository:
- Browse: cgit
- Clone: git: ssh://git.sv.gnu.org/srv/git/bash.git • ssh: ssh://git.sv.gnu.org/srv/git/bash.git • http: http://git.savannah.gnu.org/r/bash.git
Recommended Shell resources
- Greg's wiki - Greg Wooledge's (aka "greycat") wiki – with MASSIVE information about Bash and UNIX® in general.
- Sven Mascheck's pages - A goldmine of information. A must-read.
- #ksh channel page - #ksh Freenode channel page maintains a solid collection of recommended links.
- Heiner's "Shell Dorado" - Tips, tricks, links - for every situation.
Documentation / Reference
- mksh (pdksh successor)
Assorted interesting links
- History and development of the traditional Bourne shell family - very interesting and nice to read!
- Linux in general, with some shell related stuff: nixCraft: Linux Tips, Hacks, Tutorials and Ideas
Bash Libraries (needs review)
- An oo-style bash library for bash 4 - provides tools for rapid script development and huge libraries.
- General purpose shell framework for bash 4 - in development.
- General purpose bash library for bash 4 - active development
|Statistics for Month: April 2012|
|1||6833||Small getopts tutorial (March: 11663)|
|2||4025||The printf command (March: 7079)|
|3||2861||Quotes and escaping (March: 5730)|
|4||2854||The classic test command (March: 6145)|
|5||2222||Parameter expansion (March: 4540)|
|6||1760||Handling positional parameters (March: 3591)|
|7||1249||Bash 4 - a rough overview (March: –)|
|8||1212||Editing files via scripts with ed (March: 2727)|
|9||1205||The read builtin command (March: –)|
|10||1182||Lock your script (against parallel execution) (March: –)|
- "Total visits": 35144
- The overall "start" page is not counted
Visit us in
If you have critiques or suggestions, please feel free to send a mail using the contact form on the right. Note that there is a simple discussion option below every article.
Please also see the imprint if you have problems with the site and its contents (legality, …)!
It also would be nice to drop a line when
- it helped you
- it didn't help you (something missing / unclear)
- you like it
- you don't like it
- you found mistakes / bugs
Simply: Reader's feedback