Quick Start Guide:Bash
Jump to navigation
Jump to search
bash is the Bourne Again Shell[1] (based on sh, the Bourne shell). It is part of the GNU Project.
Syntax
Here is a brief outline of common syntax issues.
Login/Logout Scripts
The startup files used depend on whether the session is interactive or not, and whether it is a login shell.[2]
- ~/.bash_profile
- ~/.bash_login
- ~/.profile
- ~/.bashrc
- ~/.bash_logout
Aliases
The syntax for defining aliases is:
alias ls='ls -FC --color=auto' alias l='ls' alias ll='l -l' alias la='ll -a'
Environment Variables
The syntax for defining environment variables is:
export SPECIAL_ENV=some_string_or_other export VERY_SPECIAL_ENV=${SPECIAL_ENV}:another_string
See Also
- The GNU info standalone manual is a complete hyperlinked online manual
- The man page is terse but useful for quick lookups
- The online manual covers the latest release. It contains information identical to the info page.
- bash Quick Reference by Arnold Robbins (2006)
- Learning the bash Shell, 3/e by Cameron Newham (2005)