How do I scroll through my Bash history?

How do I scroll through my Bash history?

Scrolling through Bash History There are a few ways that we can scroll through our bash history, putting each successive command on the command line to edit. The most common way of doing this is to press the up arrow key at the command prompt. Each additional press of the up arrow key will take you further back in your command line history.

How to change up and down arrows in Bash?

Perhaps you might also want to add the following to your .bash_profile : Prepend a “!” to the command you are looking for. If you wish to replace the functionality of the up and down arrows, modifying the inputrc file (like the other answers suggest) is the way to go. You should get “command” as the output.

Which is the correct way to search Bash history?

The correct way of searching using what is already on your command line is to move your cursor to the beginning of the line with CTRL-a, call the reverse history with CTRL-r, paste the current line into the search with CTRL-y, and then using the CTRL-r again to search in reverse.

How to cycle through command line history in Bash?

Pressing Ctrl + R will open the reverse history search. Now start typing your command, this will give the first match. By pressing Ctrl + R again (and again) you can cycle through the history. To expand on what Gilles said, I have the following in my .inputrc to bind the up/down arrow key to history-search-backward and history-search-forward:

How to go back to command history in Bash?

In most cases, the “meta” key and the “>” will mean typing ALT-Shift-.. This is useful if you find yourself far back in your history and want to get back to your current command. You can go to the first line of your command history by doing the opposite maneuver and typing Meta-<. This typically means pressing ALT-Shift-,.

How to increase Bash history settings in Linux?

Some distributions already increase the default bash history settings with slightly more generous values. Open your ~/.bashrc file with an editor to change these settings: nano ~/.bashrc. Search for both the HISTSIZE and HISTFILESIZE parameters. If they are set, feel free to modify the values.

Which is the first line in the Bash command line?

To complete lesmana’s answer regarding ~/.inputrc that I should create under my Trusty 14.04, verify/add in ~/.bashrc (the first line already exists in my ~/.bashrc ): It’s already explained in French here.