==================================== Bash (Unix shell) keyboard shortcuts ==================================== First published at 9/17/2018 on https://defkey.com/bash-linux-unix-shell-shortcuts Bash is a Unix shell and a command language. First released in 1989, it has been distributed widely as the default login shell for most Linux distributions and Apple's macOS. A version of Bash can also be installed for Windows 10. Bash (Unix shell) has 39 shortcuts and we have listed all of them below. Working with processes ---------------------- Ctrl + C Kill current foreground process running in the terminal Ctrl + Z Suspend the current foreground process running in bash Ctrl + D Close the bash shell Controlling the screen ---------------------- Ctrl + L Clear the screen Ctrl + S Stop all output to the screen. This can be useful when running commands with very long output, but you don't want to stop the command 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 Home Go to the beginning of the line Ctrl + E Go to the end of the line End Go to the end of the line Ctrl + B Go left one character Alt + F Go right one word Ctrl + F Go right one character Ctrl + X then X Move between the beginning of the line and the current position of the cursor. This allows you to change something and return to original position Deleting text ------------- Ctrl + D Delete the character under the cursor Del 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 Backspace Delete the character before the cursor Correcting text --------------- Alt + T Swap the current word with the previous word Ctrl + T Swap the last two characters before the cursor with each other Ctrl + _ Undo your last key press. It can be used multiple times Esc + T Swap the last to words before the cursor Cut and paste ------------- Ctrl + W Cut the word before the cursor and add it to the clipboard Ctrl + K Cut the part of the line after the cursor and add it to the clipboard Ctrl + U Cut the part of the line before the cursor and add 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. Tab completion -------------- Tab Automatically complete the file, directory, or command you’re typing Command history --------------- Ctrl + P Go to the previous command in the command history Up arrow Go to the previous command in the command history Ctrl + N Go to the next command in the command history Down arrow Go to the next command in the command history Alt + R Revert any changes to a command you've called 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 Last modified on (UTC): Thursday, August 12, 2021 Defkey © All rights reserved.