I tend to forget these so I’m documenting them here for posterity.
1. Moving around quickly
ctrl + a– move to beginning of the line
ctrl + e– move to end of the line
alt + f– move forward
alt + b– move backward
ctrl + r – Search shell history. Keep using
ctrl + r to cycle results.
ctrl + g will preserve what you’ve typed in search and exit the search interface.
3. Clear terminal
$ clear // or ctrl + l
4. Cut and paste
ctrl + k– Cut (kill) to end of line
ctrl + u– Cut to beginning of line
alt + d– Cut word
ctrl + w– Cut word backward
ctrl + y– Pastes whatever was cut (yank!)
sudo to previoius command:
$ sudo !!
alt + . – Insert previous command’s argument
7. Unbork your shell
My faves include “pushd” and “popd” along with “dirs -v”, all aliased, of course (pu, po, d). Instead of cd’ing to different directories, pushd them onto the stack, popd them off the stack, and “pushd +n” to pull a directory off the stack.
These are great! I’ll be using
popdconstantly. Huge shortcut. Thank you!