Difference between revisions of "Bash"
(→Tips & Tricks: merged Bash completion here) |
|||
Line 16: | Line 16: | ||
= Tips & Tricks = | = Tips & Tricks = | ||
− | == | + | == History Search == |
Usually, pressing the <up> key will cause the last command to be shown, no matter what you typed so far. However, many users find it more practical to only past commands that begin with the current input. | Usually, pressing the <up> key will cause the last command to be shown, no matter what you typed so far. However, many users find it more practical to only past commands that begin with the current input. | ||
Line 28: | Line 28: | ||
Usually, when typing 'ls' and pressing <up>, your current input will be replaced with man mount. If you are using history seach, only past commands beginning with 'ls' (the current input) will be shown, in this case 'ls /usr/src/linux-2.6.15-ARCH/kernel/power/Kconfig'. | Usually, when typing 'ls' and pressing <up>, your current input will be replaced with man mount. If you are using history seach, only past commands beginning with 'ls' (the current input) will be shown, in this case 'ls /usr/src/linux-2.6.15-ARCH/kernel/power/Kconfig'. | ||
− | You can enable this mode by adding to /etc/inputrc or your ~/.inputrc | + | You can enable this mode by adding to /etc/inputrc or your ~/.inputrc |
− | "\e[A":history-search-backward | + | "\e[A":history-search-backward |
− | "\e[B":history-search-forward< | + | "\e[B":history-search-forward |
+ | |||
+ | ==Enabling Bash Completion== | ||
+ | |||
+ | Enabling bash completion is quite simple. Here's how. | ||
+ | |||
+ | <pre>pacman -Sy bash-completion</pre> | ||
+ | |||
+ | Edit ~/.bashrc and add the following: | ||
+ | |||
+ | <pre> | ||
+ | # enable bash completion in interactive shells | ||
+ | if [ -f /etc/bash_completion ]; then | ||
+ | . /etc/bash_completion | ||
+ | fi | ||
+ | </pre> |
Revision as of 11:03, 1 February 2007
Bash is the Archlinux default shell.
Ressources
- Advanced Bash Scripting Guide - Very good ressource regarding shell scripting using bash
- Bash Reference Manual - Oficial reference (654K!)
- man page
- FAQ/Wiki
- Readline Guide
- Quote Tutorial
- Completion Guide
Tips & Tricks
History Search
Usually, pressing the <up> key will cause the last command to be shown, no matter what you typed so far. However, many users find it more practical to only past commands that begin with the current input.
Consider this list of commands:
ls /usr/src/linux-2.6.15-ARCH/kernel/power/Kconfig
who
mount
man mount
Usually, when typing 'ls' and pressing <up>, your current input will be replaced with man mount. If you are using history seach, only past commands beginning with 'ls' (the current input) will be shown, in this case 'ls /usr/src/linux-2.6.15-ARCH/kernel/power/Kconfig'.
You can enable this mode by adding to /etc/inputrc or your ~/.inputrc
"\e[A":history-search-backward "\e[B":history-search-forward
Enabling Bash Completion
Enabling bash completion is quite simple. Here's how.
pacman -Sy bash-completion
Edit ~/.bashrc and add the following:
# enable bash completion in interactive shells if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi