Saturday, December 30, 2017

Navigate through bash history with page up/down key

Linux bash history with Page up / Page down

In linux you can configure the pgup/pgdown keys to navigate through commands you typed that begin with the string you just typed. Type "mysql" and then hit "Page up", and you will see nothing but mysql-related commands.

Unfortunately this has to be configured anew on every machine or server/vm I work on, and I always forget where this is configured (and it takes a while to find it in google), so I thought I should write it down.


In /etc/inputrc, uncomment:
# alternate mappings for "page up" and "page down" to search the history
"\e[5~": history-search-backward
"\e[6~": history-search-forward

Restart your shell or use Ctrl+X, Ctrl+R to tell it to re-read.
(thanks stackoverflow)

Yep, it's not ".bashrc" but "inputrc". Not sure why this one is not hidden, but so it is. You could try ~/.inputrc for a local, user-specific configuration.

Tried this in Ubuntu, and it works.

And I tried it in kde-neon and it works.

Credit goes to Andreas Hennings aka "donquixote". Visit his page about this here

No comments:

Renew letsencrypt ssl certificate for zimbra 8.8.15

 Letsencrypt certs usually consists of these files: 1. cert.pem 2. chain.pem 3. fullchain.pem 4. privkey.pem I am not going to discuss about...