Bash – History Search (Ctrl+r) sometimes only allows me to search for 2 characters

bashcommand history

History Search (Ctrl+r) sometimes only allows me to search for 2 characters

When this happens i need to close the tab and create a new one….I wish i knew what i was doing wrong to cause this to happen so i don't have to close and reopen tabs. Can anyone tell me?

  1. Ctrl+r
  2. Enter sudo
  3. But it stops at the first 2 characters:

(reverse-i-search)`su': sudo su username

Best Answer

That means that it was unable to find any command entries beyond those 2 characters. For example, if you type cd, it will return the latest cd command:

(reverse-i-search)`cd': cd $HOME

if you type cdr and it doesn't find any matching commands, it will ignore and omit the last character(s) and display what it was able to find

(reverse-i-search)`cd': cd $HOME
Related Question