Terminal Shortcuts

Shortcut Action
Ctrl + A Move to the start of the command line
Ctrl + E Move to the end of the command line
Ctrl + F Move one character forward
Ctrl + B Move one character backward
Ctrl + XX Switch cursor position between start of the command line and the current position
Ctrl + L Similar to clear command, clears the terminal screen
Ctrl + S Stops command output to the screen
Ctrl + Z Suspends current command execution and moves it to the background
Ctrl + Q Resumes suspended command
Ctrl + C Send SIGI and kill currently executing command
Ctrl + R Incremental reverse search of bash history
Ctrl + P Non-incremental reverse search of bash history
Ctrl + G Exits history mode
Ctrl + U Deletes before the cursor until the start of the command
Ctrl + K Deletes after the cursor until the end of the command
Esc + T Switch between last two words before cursor
!! Repeat last command
cd – Repates last file path

Pattern Matching

Character Description Example
* Wildcard: Matches any sequence of characters ls *.txt
? Single-character wildcard ls file?.txt
[ ] Character class: Matches any one of the enclosed characters ls file[123].txt
[^ ] Negated character class: Matches any character not in the enclosed characters ls file[^123].txt
- Range in character class: Specifies a range of characters ls file[1-3].txt
{ } Grouping: Matches any one of the comma-separated patterns mv file{.txt,.bak}
! Negation: Negates the meaning of a pattern ls !(*.txt)
() Grouping: Changes the order of evaluation in complex patterns `rm -r (backup*
` ` OR operator: Matches either of the patterns
^ Anchoring: Matches the beginning of a line grep ^start file.txt
$ Anchoring: Matches the end of a line grep end$ file.txt
Character Description Example
. Matches any single character (except newline) grep H.t matches Hat, Hot, etc.
[:alnum:] Matches any alphanumeric character grep [[:alnum:]] matches lines containing alphanumeric characters
[:alpha:] Matches any alphabetic character grep [[:alpha:]] matches lines containing alphabetic characters
[:digit:] Matches any digit grep [[:digit:]] matches lines containing digits
[:space:] Matches any whitespace character grep [[:space:]] matches lines containing whitespace
[:punct:] Matches any punctuation character grep [[:punct:]] matches lines containing punctuation
[:lower:] Matches any lowercase letter grep [[:lower:]] matches lines containing lowercase letters
[:upper:] Matches any uppercase letter grep [[:upper:]] matches lines containing uppercase letters

Close Bitnami banner
Bitnami