Computer techniques

Linux command line: configure the 'Page up' key to auto-complete from the command history


On Ubuntu, here is a script that allows you to use the auto-completion of your command line from data already entered previously (therefore present in the history), by using the Page Up key. This functionality is already present in Redhat, I found it so interesting to also integrate it on Ubuntu.

  • Edit the file .inputsrc :
    sudo nano ~/.inputrc
  • Add below lines in the file and save it :
    # Activer la recherche inversée avec la touche Page précédente
    "\e[5~": history-search-backward
    "\e[6~": history-search-forward
  • Run the following command (the 'bind' command tells the shell to read the configurations defined in the specified file and update the keybindings)
    bind -f ~/.inputrc
  • To keep this functionality on system restart, add the previous line in the .bashrc file
    nano ~/.bashrc

You can now type the beginning of a command and complete it by pressing the Page Up key.

Dernière modification le 24/05/2023 - Quillevere.net


No inscription needed if you wish to

Search in this website

fr en rss RSS info Informations