You are currently viewing Bash Shortcuts Cheat Sheet :

Bash Shortcuts Cheat Sheet :

Navigation Shortcuts

Moving the Cursor:

ShortcutDescription
Ctrl + AMove to the beginning of the line.
Ctrl + EMove to the end of the line.
Ctrl + UDelete from the cursor to the beginning of the line.
Ctrl + KDelete from the cursor to the end of the line.
Ctrl + WDelete the word before the cursor.
>> echo "Cursor movement" # Place cursor here and press Ctrl + A

>> echo "Cursor movement" # Place cursor here and press Ctrl + E

>> echo "Cursor movement" # Place cursor after 'Cursor' and press Ctrl + U

>> echo "Cursor movement" # Place cursor before 'movement' and press Ctrl + K

>> echo "Cursor movement" # Place cursor after 'Cursor' and press Ctrl + W

History Navigation:

ShortcutDescription
Ctrl + RSearch through command history.
!!Repeat the last command.
!nRepeat the nth command in history.
>> # Press Ctrl + R, then start typing a command

>> !! # Repeats the last command

>> !3 # Repeats the third command in history

Editing Shortcuts

Insert and Append:

ShortcutDescription
Ctrl + YPaste the last deleted text.
Alt + .Insert the last argument of the previous command.
>> # Type Ctrl + U to delete, then Ctrl + Y to paste the deleted text

>> echo "Hello, World!" # Press Alt + . to insert 'World!'

Case Modification:

ShortcutDescription
Alt + UUppercase the word at the cursor.
Alt + LLowercase the word at the cursor.
Alt + CCapitalize the letter under the cursor.
>> echo "hello" # Place cursor within the word and press Alt + U

>> echo "Hello" # Place cursor within the word and press Alt + L

>> echo "hello" # Place cursor on 'h' and press Alt + C

Command Manipulation:

ShortcutDescription
Ctrl + TSwap the last two characters before the cursor.
Alt + TSwap the last two words before the cursor.
>> echo "abc" # Place cursor after 'b' and press Ctrl + T

>> echo "word1 word2" # Place cursor after 'word2' and press Alt + T

Process Control Shortcuts

Background Jobs:

ShortcutDescription
Ctrl + ZSuspend a process.
bgResume a suspended process in the background.
fgBring a background process to the foreground.
>> # Run a process and then press Ctrl + Z to suspend it

>> bg # Resumes the last suspended process in the background

>> fg # Brings the last background process to the foreground

Signal Handling:

ShortcutDescription
Ctrl + CInterrupt (kill) the current process.
Ctrl + DExit the current shell or logout.
Ctrl + ZSuspend the current process.
>> # Press Ctrl + C during a running process to interrupt it

>> # Press Ctrl + D to exit the current shell

>> # Press Ctrl + D to exit the current shell

Miscellaneous Shortcuts

Clearing the Screen:

ShortcutDescription
Ctrl + LClear the terminal screen.
>> # Press Ctrl + L to clear the terminal screen

Auto-Completion:

ShortcutDescription
TabAuto-complete file and directory names.
>> ls D<Tab> # Auto-completes to 'Documents'

Terminal Multiplexer (tmux) Shortcuts:

ShortcutDescription
Ctrl + B, %Split the terminal vertically (tmux).
Ctrl + B, “Split the terminal horizontally (tmux).
Ctrl + B, Arrow keysNavigate between panes (tmux).
>> # Press Ctrl + B, then % to split the terminal vertically in tmux

>> # Press Ctrl + B, then " to split the terminal horizontally in tmux

>> # Press Ctrl + B, then Arrow keys to navigate between tmux panes

Searching History:

ShortcutDescription
Ctrl + RSearch backward in history for a command.
>> # Press Ctrl + R, then start typing a command to search in history

Exiting the Terminal:

ShortcutDescription
Ctrl + DExit the current shell or logout.
>> # Press Ctrl + D to exit the current shell

Leave a Reply