That's an excellent way to find a recently used command for inspection or reuse, but to find a command
used a few weeks ago means tediously repeating up-arrow to locate it.
You can add a simple file that will allow an alphabetical search of previously used commands with their syntax and arguments.
example:
A couple months ago I used the terminal and entered:
xrander --listactivemonitors
Yesterday I connected a different monitor and wanted to repeat that command but
didn't remember the exact syntax of the command arguments.
With the terminal open I typed
x
, then arrow up--found it on the first tap! The xrander -listactivemonitors
command wasentered and ready to use---so two keystrokes found a months old command.
If you can remember even the first letter of the command the up-arrow will find it more quickly.
Entering even more letters of the command narrows and speeds the search results even more.
example:
if you have previously used the
cat
command just type cat, then up-arrow will scroll throughthe
cat
commands previously used.This means less typing for lengthy commands--along with less fat-fingerered/pebkac/memory lapse errors.
And---it's easy
Just make a document named
.inputrc
and copy/paste the following:
Code: Select all
$include /etc/inputrc
# command history search
"\e[A": history-search-backward
"\e[B": history-search-forward
"\e[C": forward-char
"\e[D": backward-char
# extended auto-completion with tab
set show-all-if-ambiguous on
set completion-ignore-case on
# colors
set colored-completion-prefix on
set colored-stats on
# misc
set blink-matching-paren on
set mark-symlinked-directories = on
/home/username/.inputrc
Note that this document begins with a decimal point and will
become a hidden file. ctrl+h to show