Playing With Bash Using Shortcuts

Bash is the default command line shell on popular platforms such as Linux and macOS. And working with Bash may be irritating if you are not well aware of the shortcuts. Let us have a look at some of the shortcuts.

Playing With Bash Using Shortcuts

While deleting the text

Ctrl+D or Delete: Delete the character under the cursor.

Alt+D: Delete all characters after the cursor on the current line.

Ctrl+H or Backspace: Delete the character before the cursor.

While fixing 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.

While cut and paste

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.

While capitalizing the 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.

While working with history

Ctrl+P or Up Arrow: Go to the previous command in the command history. Press the shortcut multiple times to walk back through the history.

Ctrl+N or Down Arrow: Go to the next command in the command history. Press the shortcut multiple times to walk forward through the history.

Alt+R: Revert any changes to a command you’ve pulled from your history if you’ve edited it.

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.

Hope these shortcuts were helpful to you in one or the other way.

Source: www.howtogeek.com

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

You May Also Like