How to reverse-i-search in ksh through SSH?

0

I'm currently using PuTTY to connect to some Linux server (ksh on RHEL if that matters).

However using Ctrl+R doesn't work (only ^R appears on the screen). I'm quite surprised that despite all my search I didn't found anything related to this problem.

I'd like to make it work, so here are my questions:

  • Is it possible to use reverse-i-search through SSH?
  • Do I have to configure/install anything? (either PuTTY or the server).

Asoub

Posted 2018-09-20T15:58:21.590

Reputation: 63

Is your problem solved. If not, then please state clearly why. – harrymc – 2018-09-24T12:41:33.310

Answers

3

Is it possible to use reverse-i-search through SSH?

Yes. I use it on daily basis through SSH, although not in ksh.

Do I have to configure/install anything?

Your shell is ksh. This Linux & Unix SE question applies: Why can't Korn Shell do ctrl-r?

From the accepted answer:

Ctrl+R works with ksh in emacs mode (ksh -o emacs or set -o emacs within ksh), and it was most probably the first shell to support it. Only it's not as interactive as in zsh or bash or tcsh's i-search-back widget.

In ksh (both ksh88 and ksh93), you type Ctrl+RtextReturn. And Ctrl+RReturn to search again with the same text.

Another answer clarifies:

Now if you press CtrlR, the shell will print ^R; type your search, hit Enter, and the shell will show you the closest matching history entry. You can hit Enter again to run it as-is, or edit it.

I have tested it in ksh in my Debian, it works.

Kamil Maciorowski

Posted 2018-09-20T15:58:21.590

Reputation: 38 429

So it was because I was using ksh, thank you ! I've looked up a little and historyalso displays my last commands, which is pretty useful. However, I can't make "Ctrl+R" "Return" to search again with the same text (it just erases one character from the previous "Ctrl+R" result) – Asoub – 2018-09-24T11:52:05.613