Pressing Ctrl+R and typing py results in:

(reverse-i-search) `py´: python

I would like it to be this way:

(reverse-i-search) `py´: n python

where n is the history line number. I did not find an option in man bash (and wasn't surprised to find nothing, since it is a bit specific). Is there a way to achieve this by only editing the .bashrc?

  • 1
    Whats the use case? How about duplicate entries? – Milind Dumbare Apr 1 '15 at 11:42
  • Isn't the point of searching when one doesn't know number? – bsd Apr 1 '15 at 11:56
  • When reverse-searching, i find it helpful to know how far back i am currently. It would only be there to give me an estimate of how far back it is. – John H. K. Apr 1 '15 at 15:26

If there was an option to control the format of what you see during a history i-search, it would be documented in the man page. Since you didn't find such an entry, there probably isn't one.

It would probably be implemented as a shopt toggle setting, or as PS6 or something for a format string.

I agree this would be a neat UI feature, to help you know what you'll find if you up/down arrow from that point in history.

You should email the suggestion to bug-bash@gnu.org. See https://www.gnu.org/software/bash/.

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.