5

When I use the reverse search functionality of bash, oftentimes it gets stuck after entering a single symbol. For example, if my history is:

username dir$ scala -version
username dir$ git status

and then I press Ctrl + R and type in s, it gets stuck at

(reverse-i-search)`s': git status

Typing further symbols does nothing. Any idea on why does that happen?

Some information that might be relevant:

PS1:

\u \[\033[0;35m\]\W\[\033[0;37m\]$

bash version:

GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin17)
Copyright (C) 2007 Free Software Foundation, Inc.

OS:

macOS High Sierra Version 10.13.2

Terminal:

iTerm2
  • 3
    Is it possible that you typed Ctrl+s instead of s? Does Ctrl+q clear it? – Stéphane Chazelas Dec 21 '17 at 13:04
0

Because the search program found the s at end of ... status and is now looking for another command that also ends with ... status, which is does not find.

You can confirm this theory using <ctrl-R> + d instead of <ctrl-R> + s. Then the search will find the d of username d, and will continue the search from there, and e.g. will straightforwardly go "up" to username dir$ scala -version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.