Terminal command autocomplete
I'm currently trying to switch from OpenSUSE to Ubuntu as my main OS. While most of opensuse features is there in ubuntu, there is one feature that doesn't. In Opensuse, I can always use Ctrl+Up to autocomplete the command line using previously typed command. That feature is very useful for me as it allows me to work faster without having to retype long command.
Can anyone provide a way to enable this on Ubuntu?
Thank you
You can auto-complete a partially typed terminal command using Page Up, which does a reverse search of previously typed commands.
To enable this terminal functionality, i.e. to use Page Up to go match further up in terminal command history, edit the file /etc/inputrc
:
gksudo gedit /etc/inputrc
find the lines:
# alternate mappings for "page up" and "page down" to search the history
# "\e[5~": history-search-backward
# "\e[6~": history-search-forward
remove the # to uncomment the two lines:
# alternate mappings for "page up" and "page down" to search the history
"\e[5~": history-search-backward
"\e[6~": history-search-forward
and save the file.
For example typing in the terminal:
ge
Page Up
....now auto-completes to:
gedit the_doc_i_open_previously.txt
You can use the ↑ key to scroll through your history. Using Ctrl+R you can search through the history.