Friday, June 26, 2009

Bash Quick-Reference, Great Shortcuts

C-n means control-n
M-x means escape-x (few keyboards have a 'meta' key)

Finding a line in history:
C—p Move to previous line in history
C-n Mcve to next line in history
C-r Reverse search

Moving in the current line:
C-a Move to start of the current line
C-e Move to end of the current line
C-f Move forward (right) one character
C-b Move backward (left) one character
M-f Move forward one word
M-b Move back one word

Editing the current line:
del Delete the character under the cursor
bs Delete the character to the left of the cursor
C—k Kill the characters to the right of the cursor
C-u Kill the characters to the left of the cursor
M—d Delete the word to the right of the cursor
M—bs Delete the word to the left of the cursor
M-u Convert the next word to upper case
M-l Convert the next word to lower case
M—c Capitalize the first character of the next word
C-vx Insert x literally, even if x is special

Kill ring and previous line:
C-y Yank (paste) the last deleted characters
M-y Immediately following Yank, remove yanked text and replace with previous deleted text
M-. Paste the last word of the previous line
C—o Execute the current line, then present the next line in the history

Redhat

1 comment:

  1. Nice! never knew about the C-.. Commands cheers!

    ReplyDelete