Miscellaneous bash tips
A few useful configuration bits:
# Don't put duplicate lines in the history
export HISTCONTROL=ignoredups
# When you use history expansion (the !something), allows to edit the
# expanded line before executing it
shopt -s histverify
# Correct spelling mistakes when using 'cd'
shopt -s cdspell
# Do not attempt completion on an empty line
shopt -s no_empty_cmd_completion
A few useful keystrokes:
- Alt + dot: insert the last argument of the previous command. Equivalent
to inserting the expansion of
!$at the cursor position. - Alt + >: go to the end of the history. Sometimes it happens, when using
Ctrl + r, that I mistakenly land before the command that I was looking
for, and I need to hold arrow-down for a while to go back at the end. This
does the trick. Of course, Alt + < goes at the beginning. Also, Ctrl
- s
*.jpg exept maybe a few
of them? Ctrl + Alt + e does full expansion on the current line, and
Alt + ^ does history expansion only. If the expansion is too big, use
Ctrl+x then Ctrl+e, which loads the current command in an editor and
runs when you exit the editor.For more useful keystrokes, run man bash, look for "Commands for Manipulating
the History" and read down from there.