0% found this document useful (0 votes)
61 views2 pages

Bash Terminal Keyboard Shortcuts For History

This document lists 21 keyboard shortcuts for navigating and manipulating the command history in Bash terminal. Some key shortcuts include Ctrl+R to search history backward, Ctrl+G to exit history searching, Ctrl+J to finish search and run command, and !! to rerun the previous command. A variety of shortcuts allow searching for and reusing parts of previous commands.

Uploaded by

trs smriti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views2 pages

Bash Terminal Keyboard Shortcuts For History

This document lists 21 keyboard shortcuts for navigating and manipulating the command history in Bash terminal. Some key shortcuts include Ctrl+R to search history backward, Ctrl+G to exit history searching, Ctrl+J to finish search and run command, and !! to rerun the previous command. A variety of shortcuts allow searching for and reusing parts of previous commands.

Uploaded by

trs smriti
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Bash Terminal Keyboard Shortcuts for History

Learn how to utilize Bash history by adapting these shortcuts

Serial No. Shortcut Keys Functions

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 Arrow Shows the next command line.

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.

You might also like