Here we can see, “Convenient Linux Bash Terminal Keyboard Shortcuts”
Most Linux users are familiar with the Linux Bash (Bourne Again Shell) shell and command language, which is the default shell in most Linux variants.
The Linux terminal may be challenging for a new Linux user because it relies mainly on using your arrow keys to move around. Furthermore, repeatedly re-type the commands, each with a tiny modification, might be inconvenient.
On the other hand, Bash comes with several simple keyboard shortcuts and history features that help you get the most out of your terminal. We’ve compiled a list of the most often used Bash keyboard shortcuts to help you make the most of your time.
Shortcuts for the Linux Bash Terminal
Shortcut | Action |
---|---|
Bash Navigation | |
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 + ] + x | Moves the cursor forward to next occurrence of x |
Alt + F / Esc + F | Moves the cursor one word forward |
Alt + B / Esc + B | Moves the cursor one word backward |
Alt + Ctrl + ] + x | Moves cursor to the previous occurrence of x |
Bash Control/Process | |
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 | Sends SIGI signal and kills currently executing command |
Ctrl + D | Closes the current terminal |
Bash History | |
Ctrl + R | Incremental reverse search of bash history |
Alt + P | Non-incremental reverse search of bash history |
Ctrl + J | Ends history search at current command |
Ctrl + _ | Undo previous command |
Ctrl + P / Up arrow | Moves to previous command |
Ctrl + N / Down arrow | Moves to next command |
Ctrl + S | Gets the next most recent command |
Ctrl + O | Runs and re-enters the command found via Ctrl + S and Ctrl + R |
Ctrl + G | Exits history search mode |
!! | Runs last command |
!* | Runs previous command except its first word |
!*:p | Displays what !* substitutes |
!x | Runs recent command in the bash history that begins with x |
!x:p | Displays the x command and adds it as the recent command in history |
!$ | Same as OPTION+., brings forth last argument of the previous command |
!^ | Substitutes first argument of last command in the current command |
!$:p | Displays the word that !$ substitutes |
^123^abc | Replaces 123 with abc |
!n:m | Repeats argument within a range (i.e, m 2-3) |
!fi | Repeats latest command in history that begins with fi |
!n | Run nth command from the bash history |
!n:p | Prints the command !n executes |
!n:$ | Repeat arguments from the last command (i.e, from argument n to $) |
Bash Editing | |
Ctrl + U | Deletes before the cursor until the start of the command |
Ctrl + K | Deletes after the cursor until the end of the command |
Ctrl + W | Removes the command/argument before the cursor |
Ctrl + D | Removes the character under the cursor |
Ctrl + H | Removes character before the cursor |
Alt + D | Removes from the character until the end of the word |
Alt + Backspace | Removes from the character until the start of the word |
Alt + . / Esc+. | Uses last argument of previous command |
Alt + < | Moves to the first line of the bash history |
Alt + > | Moves to the last line of the bash history |
Esc + T | Switch between last two words before cursor |
Alt + T | Switches current word with the previous |
Bash Information | |
TAB | Autocompletes the command or file/directory name |
~TAB TAB | List all Linux users |
Ctrl + I | Completes the command like TAB |
Alt + ? | Display files/folders in the current path for help |
Alt + * | Display files/folders in the current path as parameter |
There’s a lot more to learn about Linux
The Bash shell keyboard shortcuts work around the developer’s DRY (Don’t Repeat Yourself) philosophy. They can help you make better use of your time by increasing productivity in a fast-paced workplace.
The cheat sheet above is only the tip of the iceberg. The more you learn about Linux terminal commands and Bash shortcuts, the simpler and more intriguing the operating system becomes.
User Questions
1. What does Ctrl Z do in bash?
Ctrl+Z: In bash, suspend the current foreground process. The SIGTSTP signal is sent to the process as a result of this. Use the fg process name command to bring the process later back to the foreground.
2. How do I use Ctrl C in the Linux terminal?
You may either use Ctrl + Shift + C to copy text from the terminal or use your mouse to pick the text you want to paste and then use the middle-click to paste it.
3. How do you use Ctrl R?
Ctrl+R, often known as Control R or C-r, is a shortcut key that is most commonly used to refresh the page in a browser. To utilize the keyboard shortcut Ctrl+R, press and hold either Ctrl key on the keyboard, then press and hold the “R” key with either hand while continuing to hold.
4. Besides fast keyboard shortcuts, what’s the fundamental advantage of Vim? – Reddit
Besides fast keyboard shortcuts, what’s the fundamental advantage of Vim? from vim
5. Linux terminal keyboard shortcuts : r/coolguides – Reddit