60 Linux Bash Terminal Keyboard Shortcuts 1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

60 Linux Bash Terminal Keyboard

Shortcuts
Bash(Bourne Again Shell) is the most popular command language interpreter for the GNU
operating system. It supports functions, variables, and flow controls and also reads and
executes commands from a file. Here we have listed 60 Linux Bash Terminal keyboard
shortcuts with their functions.

1. Bash Navigation
To master the terminal uses of the Linux operating system, At first one should learn
how to navigate through the terminal quickly using these shortcuts.

Serial Shortcut Keys Functions


No.
1. Ctrl + A Moves to the beginning of the current command line.

2. Ctrl + E Moves to the ending of the current command line.

3. Alt + B / Esc + B Moves the cursor one word backward from the current
cursor position.

4. Alt + F / Esc + F Moves the cursor one word forward from the current
cursor position.

5. Ctrl + B / Left Arrow Moves one character backward from the current
cursor position.

6. Ctrl + F / Right Moves one character forward from the current cursor
Arrow position.

7. Ctrl + XX Switches between the start of the line and the current
cursor position.

8. Ctrl + ] + A Moves the cursor forward to the next character of A.

9. Alt + Ctrl + ] + A Moves the cursor backward to the preceding


character of A.
2. Bash Control/Process
To control the commands and process the terminal, the following shortcuts are the main
keys.

Serial Shortcut Keys Function


No.
1. Ctrl + C Stops the currently running command.

2. Ctrl + D Closes the current terminal.

3. Ctrl + L Alike the clear command clears the whole terminal


screen.

4. Ctrl + Q Resumes suspended commands.

5. Ctrl + S Stops command output to the screen.

6. Ctrl + Z Stops the current command and places it in the


background.

3. Bash History
Learn how to utilize Bash history by adapting these shortcuts.

Serial Shortcut Keys Function


No.
1. Ctrl + G Exits from the history searching mode.

2. Ctrl + J Finishes the history search at the ongoing command


line.

3. Ctrl + O Runs the command found in reverse search (Ctrl + S


and Ctrl + R)

4. Ctrl + N / Down Shows the next command line.


Arrow

5. Ctrl + P / Up Arrow Shows the previous command line.

6. Ctrl + R Searches the history backward from the current line.

7. Ctrl + _ Undo the last action.

8. Alt + P Searches the history forward from the current line.


9. !! Runs the previous command.

10. !* Runs the previous command excluding its initial word.

11. !*:b Shows anything ending with :b

12. !b Runs the recent command that starts with b.

13. !b:p Shows the b command and put it in history.

14. !$ / Alt + . Shows the last argument of the latest command.

15. !$:b Shows any word that “!&” replaces.

16. !^ Replaces the initial argument of the previous


command in the present one.

17. ^pqr^xyz Replaces pqr with xyz in the last command.

18. !n:m Runs arguments within a range.

19. !n Executes nth command from the bash history.

20. !n:b Prints the previous command starting with b.

21. !n:$ Repeats arguments from nth to the last command.

4. Bash Editing
Editing is the most important aspect of a power user. These shortcuts will help you to get
the most out of Bash.

Serial Shortcut Keys Function


No.
1. Ctrl + D Deletes the character under the cursor.

2. Ctrl + H Deletes the previous character under the cursor, it works


the same as backspace.

3. Ctrl + K Removes everything after the cursor to the end.

4. Ctrl + U Removes everything before the cursor to the beginning.

5. Ctrl + W Removes the word before the cursor.

6. Ctrl + i Completes the command automatically.


7. Ctrl + Y Retrieve the most recently killed text. Also called Yanking

8. Alt + D/delete Removes from the cursor to the end of the word.

9. Alt + T Swaps the current argument with the previous one.

10. Alt + Backspace Removes the preceding word.

11. Alt + > Goes to the initial line of the history.

12. Alt + > Goes to the final line of the history.

13. Alt + . / Esc + . Displays the final argument of the last command.

14. Alt + U Makes uppercase letters from the current position to the
end of the word.

15. Alt + L Makes lowercase letters from the current position to the
end of the word.

16. Alt + R Undo all changes to the current line.

17. Alt + Ctrl + E Dilates the current command line.

5. Bash Information
Use the following shortcuts to manage the Bash Information.

Serial Shortcut Keys Function


No.
1. TAB Completes the existing file/folder name automatically

2. ~ TAB TAB Shows the total list of every user.

3. Altr + ? Shows the file/folder names in the current path as help.

4. Altr + * Shows the file/folder names in the current path as


parameters.

5. $ TAB TAB Shows every system variable.

6. @ TAB TAB Shows all the entities in the /etc/hosts file.

7. cd - Takes back to the previous folder.

You might also like