The Bash command line isn’t always easy to navigate since you can’t use your mouse. With that in mind, we wanted to create a useful list of emacs-mode shortcuts to help you navigate it!
emacs editing mode – CTRL delete/move character shortcuts
These are basic commands that use the control keyboard button. Basically these are ways to delete a character.
Shortcut | What it Does |
---|---|
CTRL-B | Allows you to move backward one character without deleting |
CTRL-F | Allows you to move forward one character without deleting |
DEL | Lets you delete one character backwards |
CTRL-D | Lets you delete one character forwards |
emacs editing mode – escape delete/move/kill keyboard shortcuts
These are basic commands that use the escape keyboard button. These commands allow you to move or delete entire words.
Shortcut | What it Does |
---|---|
ESC-B | Allows you to move backward one word without deleting |
ESC-F | Allows you to move forward one word without deleting |
ESC-DEL ESC-CTRL-H |
Lets you delete or “kill” one word backwards |
ESC-D | Lets you delete or “kill” one word forward |
emacs editing mode – line command move/kill/delete shortcuts
These are basic commands that use the CTRL keyboard buttons. These commands allow you to move around, delete or “kill” an entire line.
Shortcut | What it Does |
---|---|
CTRL-A | Move cursor to the beginning of the line |
CTRL-E | Move to the end of the line |
CTRL-K | Kill forward to the end of a line |
CTRL-U | Kill the line from the beginning to this point |
emacs editing mode – using historical information
These are basic commands that use the CTRL and ESC keyboard buttons. These commands recall your history.
Shortcut | What it Does |
---|---|
CTRL-R | Search Backwards |
CTRL-P | Move to the previous line |
CTRL-N | Move to the next line |
ESC-< | Move to the first line in the history file |
ESC-> | Move to the last line in the history file |
emacs editing mode – completion shortcuts
The textual commands help you autocomplete names of commands, user names, file names, functions, etc… When you type in a word of text followed by TAB, bash will try to finish the filename for you. This is one of the most powerful but less used bash shortcuts.
Shortcut | What it Does |
---|---|
TAB | Try to finish the text |
ESC-TAB | Attempt the completion from previous commands in the history list |
ESC-? | List all the possible completions |
ESC-/ | Attempt the filename completion |
ESC-~ | Attempt the username completion |
ESC-$ | Attempt a variable completion |
ESC-@ | Attempt hostname completion |
ESC-! | Attempt the command completion |
CTRL-X / | List the possible filename completions |
CTRL-X ~ | List the possible username completions |
CTRL-X $ | List the possible variable completions |
CTRL-X @ | List the possible hostname completions |
CTRL-X ! | list the possible command completions |
The SmartFile Favorite Bash Shortcuts
These are some of our favorite emac shortcuts here at SmartFile. Enjoy!
Shortcut | What it Does |
---|---|
CTRL-Y | Undo the last word/line deleted or “killed” |
CTRL-L | Clears the screen and puts the line your working on at the top |
CTRL-T | Transpose 2 characters on either side of a point and move that point forward by one |
CTRL-V | Quoted insert |
ESC-C | Capitalize this word after this point |
ESC-U | Make the letters in this word all uppercase after this point |
ESC-L | Make the letters in this word all lowercase after this point |
Overall, we hope these bash shortcuts help save you some time in your day. We have a few other shortcuts as well, including FTP commands and FTP error codes. Check them out!
Want a Printer Friendly Version to Share or Hang on Your Wall?
Sources: Internal SmartFile I.T. and Learning the bash Shell by Cameron Newham & Bill Rosenblatt