Bash Keyboard Shortcuts for the pro!

Typically, we use arrow keys to control shell behaviors like moving the cursor from one point to another point. Also, it’s quite common to make mistakes while writing commands and to correct these you may use arrow keys + backspace, which is not optimal at all.

In the bash terminal, you can use several keystrokes to control the shell features that you are going to see.

List of Keystrokes to move cursor

The first thing you should know is how to move the cursor using the list of keystrokes that you can use to move around the shells.

  • Ctrl + A: directly jump to the start of the command line
  • Ctrl + E: move to the end of the line
  • Ctrl + B: move cursor to the left
  • Ctrl + F: move cursor to the right
  • Alt + B: jump to the left word
  • Alt + F: jump to the right word.
  • Ctrl + leftkey: similar to Alt + B
  • Ctrl + rightkey : jump to right word to Alt + F

List of Keystrokes to manipulate text

Does it make your work easier? Of course, yes. Now you will see more keystrokes that can manipulate text.

  • Ctrl + U: erase or cut the whole line
  • Ctrl + K: erase or cut the line after the cursor positions
  • Ctrl + Y: paste word or text that has cut
  • Ctrl + D: delete character under the cursor
  • Ctrl + H: delete character under the cursor including backspace
  • Ctrl + W: delete words before the cursor
  • Ctrl + T: swap character with a last character
  • Esc + T: swap last two words
  • Alt + U: change lowercase to UPPERCASE to end of cusor
  • Alt + I: change UPPERCASE to lowercase character to end of cursor
  • Alt + C: make an uppercase character which is under cursor
  • Alt + D: delete word or character next to cursor

Common Keystrokes to use

Some of the common keystrokes that you can use while working on the terminal are listed below.

  • Ctrl + P: go backward through your previous invoked command
  • Ctrl + N: go forward through your invoked command
  • !!: run last executed command
  • Ctrl + R: search command from history
  • Ctrl + L: clear the screen
  • Ctrl + S: suspend command output
  • Ctrl + Q: resume command output
  • Ctrl + Z: stop command
  • Ctrl + C: Exit command

Wrap up

If we missed something to put on shelves, then please let me know in the comment section.

Likely to read: How to Lock Keyboard on Linux & Windows

Likely to read: Displaying Local/Global IP using Shortcut Key for KDE.

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments