Some bash shortcut for Mac OsX found in different webpages
Very useful to move around and do little magic with bash
Ctrl-a | Move to the start of the line.
Ctrl-e | Move to the end of the line.
Ctrl-] x | Where x is any character, moves the cursor forward to the next occurance of x.
Ctrl-u | Delete from the cursor to the beginning of the line.
Ctrl-k | Delete from the cursor to the end of the line.
Ctrl-d | delete one character at the cursor position
Ctrl-w | Delete from the cursor to the start of the big word (space delimited). Add deleted word to clipboard
Ctrl-t | transpose two previous characters
Esc BackSpace | Delete previous small word (delimited by anything that is not a number or a letter)
Esc f | move forward a small word
Esc b | move backward a small word
Esc u | Uppercase word under cursor and move to next word.
Esc l |Lowercase word under cursor and move to next word.
Esc . | Insert last word from previous command after cursor.<
Ctrl – xx | move between start of command line and current cursor position (and back again)
Esc t | transpose two adjacent “words”
Ctrl-y | Pastes text from the clipboard.
Ctrl-_ | Undo the last changes.
Ctrl-r | Incremental reverse search of history.
!! | Execute last command in history
!abc | Execute last command in history beginning with abc
!abc:p | Print last command in history beginning with abc
!* | The previous command except for the first word
!$ | Last argument of last command
!^ | First argument of last command
(these last commands with :p do not get executed)
!n | Execute nth command in history
^abc^xyz | Replace first occurance of abc with xyz in last command and execute it
Ctrl-c | Kill whatever you are running
Ctrl-d | Exit the current shell
Ctrl-z | Puts whatever you are running into a suspended background process. fg restores it.