OPNsense Forum

Archive => 20.7 Legacy Series => Topic started by: TheLinuxGuy on January 19, 2021, 04:36:06 AM

Title: [SOLVED] How to enable "reverse-search-history" in opnsense shell?
Post by: TheLinuxGuy on January 19, 2021, 04:36:06 AM
I miss the ability to do CTRL + R and regex search past commands in linux terminal.

It seems like opnsense implements shell at /usr/local/sbin/opnsense-shell << is it possible to add the ability to CTRL+R regex search in this shell?

Item 2 in this guide shows a GIF of what I mean by reverse-i-search: https://thomasweng.com/terminal_tips/

Thanks
Title: Re: How to enable "reverse-search-history" in opnsense shell?
Post by: franco on January 19, 2021, 12:42:23 PM
You can change the root shell away from csh to something else, but opnsense-shell is just a menu wrapper and selects csh on option 8 in any case.


Cheers,
Franco
Title: Re: How to enable "reverse-search-history" in opnsense shell?
Post by: Fright on January 19, 2021, 07:53:24 PM
bindkey ^R i-search-back ?
Title: Re: How to enable &quot;reverse-search-history&quot; in opnsense shell?
Post by: fabian on January 19, 2021, 08:00:43 PM
CTRL + R is AFAIK a feature of GNU readline and not a feature of a shell. Since zsh does not build on readline, you can use that if you install that or you can use a readline based shell like bash if you install it.
Title: Re: How to enable &quot;reverse-search-history&quot; in opnsense shell?
Post by: TheLinuxGuy on January 20, 2021, 05:21:36 AM
Quote from: fabian on January 19, 2021, 08:00:43 PM
CTRL + R is AFAIK a feature of GNU readline and not a feature of a shell. Since zsh does not build on readline, you can use that if you install that or you can use a readline based shell like bash if you install it.

Thanks for the pointer.

I went into the $SHELL file that executes for opnsense and edited the $SHELL_CMD= to the bash path. Now when I hit option 8 in menu it takes me to my preferred shell which does have the reverse search.
Title: Re: [SOLVED] How to enable "reverse-search-history" in opnsense shell?
Post by: franco on January 20, 2021, 09:13:00 AM
Mind you, this will be overwritten with the next update. I'm not against something more permanent but the need was never there before so it is what it is right now.


Cheers,
Franco