Delete from the cursor to the beginning of the line.
Ctrl + K
Delete from the cursor to the end of the line.
Ctrl + W
Delete 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:
Shortcut
Description
Ctrl + R
Search through command history.
!!
Repeat the last command.
!n
Repeat 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:
Shortcut
Description
Ctrl + Y
Paste 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:
Shortcut
Description
Alt + U
Uppercase the word at the cursor.
Alt + L
Lowercase the word at the cursor.
Alt + C
Capitalize 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:
Shortcut
Description
Ctrl + T
Swap the last two characters before the cursor.
Alt + T
Swap 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:
Shortcut
Description
Ctrl + Z
Suspend a process.
bg
Resume a suspended process in the background.
fg
Bring 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:
Shortcut
Description
Ctrl + C
Interrupt (kill) the current process.
Ctrl + D
Exit the current shell or logout.
Ctrl + Z
Suspend 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:
Shortcut
Description
Ctrl + L
Clear the terminal screen.
>># Press Ctrl + L to clear the terminal screen
Auto-Completion:
Shortcut
Description
Tab
Auto-complete file and directory names.
>> ls D<Tab># Auto-completes to 'Documents'
Terminal Multiplexer (tmux) Shortcuts:
Shortcut
Description
Ctrl + B, %
Split the terminal vertically (tmux).
Ctrl + B, “
Split the terminal horizontally (tmux).
Ctrl + B, Arrow keys
Navigate 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:
Shortcut
Description
Ctrl + R
Search backward in history for a command.
>># Press Ctrl + R, then start typing a command to search in history