Search Articles   Keywords



Keyboard Shortcuts For Bash

Keyboard Shortcuts For Bash


  1. 1. Starting/Stopping Processes
    1. 1.1. Ctrl+C
    2. 1.2. Ctrl+Z
    3. 1.3. Ctrl+D
  2. 2. Controlling the Screen
    1. 2.1. Ctrl+L
    2. 2.2. Ctrl+S
    3. 2.3. Ctrl+Q
  3. 3. Moving the Cursor
    1. 3.1. Ctrl+A
    2. 3.2. Ctrl+E
    3. 3.3. Alt+B
    4. 3.4. Ctrl+B
    5. 3.5. Alt+F
    6. 3.6. Ctrl+F
    7. 3.7. Ctrl+XX
  4. 4. Deleting Text
    1. 4.1. Ctrl+D
    2. 4.2. Alt+D
    3. 4.3. Ctrl+H
  5. 5. Fix Typos
    1. 5.1. Alt+T
    2. 5.2. Ctrl+T
    3. 5.3. Ctrl+_
  6. 6. Cutting & Pasting
    1. 6.1. Ctrl+W
    2. 6.2. Ctrl+K
    3. 6.3. Ctrl+U
    4. 6.4. Ctrl+Y
  7. 7. Capitalizing Characters
    1. 7.1. Alt+U
    2. 7.2. Alt+L
    3. 7.3. Alt+C
  8. 8. Command History
    1. 8.1. Ctrl+R
    2. 8.2. Ctrl+O
    3. 8.3. Ctrl+G

Here is a list of keyboard shortcuts available for the bash shell. They are organized by category.

Starting/Stopping Processes

Ctrl+C

Interrupt (kill) the current foreground process running in in the terminal. This sends the SIGINT signal to the process, which is technically just a request—most processes will honor it, but some may ignore it.[1]

Ctrl+Z

Suspend the current foreground process running in bash. This sends the SIGTSTP signal to the process. To return the process to the foreground later, use the fg process_name command.[1:1]

Ctrl+D

Close the bash shell. This sends an EOF (End-of-file) marker to bash, and bash exits when it receives this marker. This is similar to running the exit command.[1:2]

Controlling the Screen

Ctrl+L

Clear the screen. This is similar to running the “clear” command.

Ctrl+S

Stop all output to the screen. This is particularly useful when running commands with a lot of long, verbose output, but you don’t want to stop the command itself with Ctrl+C.

Ctrl+Q

Resume output to the screen after stopping it with Ctrl+S.

Moving the Cursor

Ctrl+A

Go to the beginning of the line.

Ctrl+E

Go to the end of the line.

Alt+B

Go left (back) one word.

Ctrl+B

Go left (back) one character.

Alt+F

Go right (forward) one word.

Ctrl+F

Go right (forward) one character.

Ctrl+XX

Move between the beginning of the line and the current position of the cursor. This allows you to press Ctrl+XX to return to the start of the line, change something, and then press Ctrl+XX to go back to your original cursor position. To use this shortcut, hold the Ctrl key and tap the X key twice.

Deleting Text

Ctrl+D

Delete the character under the cursor.

Alt+D

Delete all characters after the cursor on the current line.

Ctrl+H

Delete the character before the cursor.

Fix Typos

Alt+T

Swap the current word with the previous word.

Ctrl+T

Swap the last two characters before the cursor with each other. You can use this to quickly fix typos when you type two characters in the wrong order.

Ctrl+_

Undo your last key press. You can repeat this to undo multiple times.

Cutting & Pasting

Ctrl+W

Cut the word before the cursor, adding it to the clipboard.

Ctrl+K

Cut the part of the line after the cursor, adding it to the clipboard.

Ctrl+U

Cut the part of the line before the cursor, adding it to the clipboard.

Ctrl+Y

Paste the last thing you cut from the clipboard. The y here stands for “yank”.

Capitalizing Characters

Alt+U

Capitalize every character from the cursor to the end of the current word, converting the characters to upper case.

Alt+L

Uncapitalize every character from the cursor to the end of the current word, converting the characters to lower case.

Alt+C

Capitalize the character under the cursor. Your cursor will move to the end of the current word.

Command History

Ctrl+R

Recall the last command matching the characters you provide. Press this shortcut and start typing to search your bash history for a command.

Ctrl+O

Run a command you found with Ctrl+R.

Ctrl+G

Leave history searching mode without running a command.


  1. https://www.howtogeek.com/howto/ubuntu/keyboard-shortcuts-for-bash-command-shell-for-ubuntu-debian-suse-redhat-linux-etc/ ↩︎ ↩︎ ↩︎