The following shortcuts work when using default (Emacs) key bindings. Vi-bindings can be enabled by running set -o vi.
Tab ⇆ : Autocompletes from the cursor position.
Ctrl+a : moves the cursor at the beginning of the line (equivalent to the key Home).
Ctrl+e : (end) moves the cursor at the line end (equivalent to the key End).
Ctrl+p : (previous) recalls the previous command (equivalent to the key ↑).
Ctrl+n : (next) recalls the next command (equivalent to the key ↓).
Ctrl+r : (research) recalls the last command including the specified character(s). A second Ctrl+r recalls the next anterior command which corresponds to the research
Ctrl+s : Go back to the next more recent command of the research (beware to not execute it from a terminal because this command also launches its XOFF). If you changed that XOFF setting, use Ctrl+q to return.
Ctrl+o : executes the found command from research.
Ctrl+l : clears the screen content (equivalent to the command clear).
Ctrl+u : clears the line content before the cursor and copy it in the clipboard.
Ctrl+k : clears the line content after the cursor and copy it in the clipboard.
Ctrl+w : clears the word before the cursor and copy it in the clipboard.
Ctrl+y : (yank) adds the clipboard content from the cursor position.
Ctrl+d : sends an EOF marker, which (unless disabled by an option) closes the current shell (equivalent to the command exit).
Ctrl+c : sends the signal SIGINT to the current task, which aborts and closes it.
Ctrl+z : sends the signal SIGTSTP to the current task, which suspends it. To return to it later one can enter fg ‘process name’ (foreground).
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.
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.
0 Responses to “Bash Shell Keyboard shortcuts”