There is Ctrl-y for pasting deleted strings, which goes along very well with these commands:
Ctrl-k delete to end of line
Ctrl-u delete to beginning of line
Alt-d delete to end of word
Ctrl-w delete to beginning of word
Alt-Backspc same
Bash keybindings behave like Emacs by default, hence every time you invoke one of these, it will put the string into a buffer, which can be later pasted using Ctrl-y.
This is very useful. For instance, if you remembered that you didn't `mkdir /mnt/disk` while in the middle of the command `mount /dev/sdb /mnt/disk`, you can delete what you have already typed with Ctrl-u; issue `mkdir /mnt/disk`; than you can paste the previous command with Ctrl-y. Very useful and I use it all the time! (Ctrl-u have never tied to my muscle memory, so I usually do Ctrl-a Ctrl-k to move to the beginning of the line and delete what comes next).
Other tips:
cd goes to home dir
Ctrl-] moves cursor to character (such as vim f)
Ctrl+Meta+] moves to character backwards (vim F)
I also put these in my .bashrc for searching history pressing up/down.
This is different of searching with Ctrl-r. When you type part of a command, such as
mkdir /dev
and press up, it will complete with previous ocurrences of commands starting with `mkdir /dev`. It is faster than Ctrl-r if you already know what to do.
This is very useful. For instance, if you remembered that you didn't `mkdir /mnt/disk` while in the middle of the command `mount /dev/sdb /mnt/disk`, you can delete what you have already typed with Ctrl-u; issue `mkdir /mnt/disk`; than you can paste the previous command with Ctrl-y. Very useful and I use it all the time! (Ctrl-u have never tied to my muscle memory, so I usually do Ctrl-a Ctrl-k to move to the beginning of the line and delete what comes next).
Other tips:
I also put these in my .bashrc for searching history pressing up/down. This is different of searching with Ctrl-r. When you type part of a command, such as and press up, it will complete with previous ocurrences of commands starting with `mkdir /dev`. It is faster than Ctrl-r if you already know what to do.