Sunday, August 2, 2009

Bash shell Command line editing

Note that these commands are not case sensitive.

Ctrl + A           Go to the beginning of the line you are currently typing on
Ctrl + E           Go to the end of the line you are currently typing on
Ctrl + L           Clears the Screen, similar to the clear command
Ctrl + U           Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
Ctrl + H           Same as backspace
Ctrl + R           Let’s you search through previously used commands (type few letters of the command)
CTRL + O           Executes the found command from research
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.
Ctrl + W           Delete the word before the cursor
Ctrl + K           Clear the line after the cursor
Ctrl + T           Swap the last two characters before the cursor
Esc  + T           Swap the last two words before the cursor
ALT + F            (forward) moves forward the cursor of one word.
ALT + B            (backward) moves backward the cursor of one word.
ALT + del          cuts the word before the cursor.
ALT + D            cuts the word after the cursor.
ALT + U            capitalizes every character from the cursor's position to the end of the current word.
ALT + L            lowers the case of every character from the cursor's position to the end of the current word.
ALT + C            capitalizes the character under the cursor and moves to the end of the word.
ALT + R            Cancels the changes and put back the line as it was in the history.
Tab                Auto-complete files and folder names
CTRL + X CTRL + X  (because x has a crossing shape) alternates the cursor with its old position.
CTRL + X CTRL + E  (editor because it takes the $EDITOR shell variable) edits the current line in vi.
Shift + Insert     Paste the content from Clipboard to current cursor position