Enabling emacs Mode
To enable emacs mode in Bash, add the following line to your .bashrc file:
set -o emacs
Then, reload your .bashrc file:
source ~/.bashrc
Basic Navigation
Ctrl-a: Move to the beginning of the line.Ctrl-e: Move to the end of the line.Ctrl-b: Move backward one character.Ctrl-f: Move forward one character.Meta-b: Move backward one word.Meta-f: Move forward one word.
Editing
Ctrl-d: Delete the character under the cursor.Ctrl-k: Delete from the cursor to the end of the line.Ctrl-u: Delete from the cursor to the beginning of the line.Ctrl-w: Delete the word before the cursor.Meta-d: Delete the word after the cursor.Ctrl-y: Yank (paste) the last killed text.Ctrl-_orCtrl-x Ctrl-u: Undo the last change.
Inserting Text
Ctrl-t: Transpose the character before the cursor with the character under the cursor.Meta-t: Transpose the word before the cursor with the word under the cursor.
Searching
Ctrl-r: Search backward incrementally.Ctrl-s: Search forward incrementally.
Miscellaneous
Ctrl-l: Clear the screen and redisplay the current line at the top.Ctrl-x Ctrl-e: Open the current command in the default editor (usuallyemacs).
Key Modifiers
Ctrl(Control): Often abbreviated asC-.Meta(usuallyAltorEsc): Often abbreviated asM-.
No comments:
Post a Comment