If you spend a lot of time on CLI mode, you should definitely used or heard about reverse search function in Bash (Bash is a command processor that typically runs in a text window). The keyboard shortcut to do reverse search in Bash is Ctrl+r. Using bash reverse search, we can bring up all commands which we used previously executed without having to re-type them every time. You can, of course, use UP/DOWN arrows to search your bash history. However, Ctrl+r will make this process much easier and faster. Today, I Stumbled upon a replacement to ‘Ctrl+r’ Bash history search feature. Meet “McFly”, a simple tool written in Rust programming language that replaces the default Ctrl+r Bash history search with an intelligent search engine. All command suggestions made by McFly are prioritized in real-time with a small neural network.
When suggesting a command, McFly considers the following facts:
* On which directory you ran the command. You’re likely to repeat that command in the same directory in future.
* What commands you typed before the command.
* How often you run the command.
* When you last ran the command.
* If you’ve selected the command in McFly before.
* The command’s historical exit status. Because, you probably don’t want to run old failed commands, right?
McFly maintains your default Bash history file, so you can stop using McFly at any time. McFly is not just for Bash, it is also extendable for other shells as well.
See how to install and use it at https://www.ostechnix.com/mcfly-a-replacement-to-ctrlr-bash-history-search-feature/.
I see Arch has it available for quick install directly from its repos.
#linux McFly - A Replacement To 'Ctrl+R' Bash History Search Feature
McFly is a simple tool written in Rust programming language that replaces the default Ctrl+r Bash history search with an intelligent search engine.