An attempt at saner Bash defaults. Inspired by Tim Pope's sensible.vim.
Sensible Bash is intended to be a simple starting point for a better Bash user experience out of the box.
Refer to the commented source for a complete list of all the options with explanations. Here's a taste:
Smarter tab completion
Readline bindings to improve on Bash's default tab completion:
- Perform file completion in a case insensitive fashion
- Treat hyphens and underscores as equivalent
- Display matches for ambiguous patterns at the first press of the tab key (instead of requiring two tab-presses)
Saner history defaults
Sensible defaults for the command history:
- Append to the history file instead of overwriting it
- Save multi-line commands as one command
- Record each line as it gets issued
- Keep track of a bigger history
- Avoid duplicate entries
- Avoid recording unneeded commands (
- Use a standard ISO 8601 timestamp for recording commands (ex:
Read more about the settings used here in the article Better Bash History by Tom Ryder.
Faster file system navigation
Options that considerably speed up the ability to navigate throughout the file system:
cdto directory names automatically, so you can change to a directory just by typing its name
- Automatically correct spelling errors during tab-completion and in arguments supplied to
- Set more targets to the
cdcommand besides the current working directory (ex:
- Define paths as variables and
cdinto it from anywhere, kind of like a bookmarking system for Bash (
You can copy
sensible.bash in your
bashrc, cherry-pick the options you like, or source the file at the top of your
if [ -f ~/bin/sensible.bash ]; then source ~/bin/sensible.bash fi
In order to get Sensible Bash to work correctly, make sure that:
- You're running at least Bash 4.x (
echo $BASH_VERSION). OS X users: Read this to install and set up Bash correctly.
- You have the Bash Completion package installed and properly configured on your system. (instructions for OS X)
- If you're on OS X, I recommend to follow Josh Staiger's advice and source
bash_profileso to keep all your configuration in one place.
Consider this as a work in progress where everything is open for discussion. I'm looking for feedback! Feel free to open an issue, submit a pull request, or let me know on Twitter if you think I've missed something important. Same goes for options you think should be removed.
- My article about Sensible Bash
- My dotfiles for more *nix configuration goodies
- Unix as IDE, my ebook port of the excellent post series by Tom Ryder