Intro to UNIX
Bash Tricks
- Filename Completion:
- Type part of the filename, then use
tab
key.
- If you haven't typed enough to uniquely identify the file,
it will only complete as far as it can, then pause. Hit the
tab
key again to have it show you the
possibilities, type just enough letters to get past the
ambiguity, then hit the tab
key again.
- Rerun a previous command:
up arrow | rerun last command |
!! | rerun last command |
!gr | rerun last command that
started with "gr" |
- Edit a previous command:
- Use up-arrow and emacs commands
- If you prefer vi, add
set -o vi
to your
.bashrc
file, then re-execute your
.bashrc
by typing . .bashrc
(you
only have to do that once). From then on, use ESC
to get to command mode, use up-arrow or k
to move
up, use /pattern
to search for a pattern in
previous commands, and use normal vi commands to edit.
Alyce Brady, Kalamazoo College