FOSSPicks
History search
McFly
One of the best features of the Bash command line is its history, handily stored in the .bash_history
file, so it can be easily deleted. Apart from searching through the file manually, or with the history
command, and using the up and down cursor keys to manually step through the history, its best trick is accomplished by pressing Ctrl+R to initiate a search. This lets you search for commands you know you typed but don't know exactly where to find. As soon as you've mastered Ctrl+R, it becomes a part of almost every command incantation on the command line. But Ctrl+R for history is also somewhat limited in its search capabilities, and that's where McFly comes in.
McFly is a Ctrl+R history replacement for the command line. It's easily installed via Rust's Cargo package manager and requires a single line added to your shell config. The first time you run your Bash terminal after installing McFly, it creates a database from your history, and this takes a few seconds. The new database includes added details, such as exit status and time stamp, but your old history is also maintained in parallel. The indexing is only done on the first launch, so it isn't too much of an inconvenience. You're then left with your normal prompt and the tantalizing possibilities that lie behind pressing Ctrl+R. Start typing a command, and pressing Ctrl+R takes you into a full-screen terminal application, complete with fuzzy search results listed below your prompt. This is the clever part, because behind the scenes a neural network is sorting these results, taking into account your current directory, the commands before the current one, when you last ran the command, and other variables. You can navigate through the results, but they're often so good you won't need to. It works like magic and can transform the way you use the command line.
Project Website
https://github.com/cantino/mcfly
Regex parser
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.
-
XZ Gets the All-Clear
The back door xz vulnerability has been officially reverted for Fedora 40 and versions 38 and 39 were never affected.
-
Canonical Collaborates with Qualcomm on New Venture
This new joint effort is geared toward bringing Ubuntu and Ubuntu Core to Qualcomm-powered devices.
-
Kodi 21.0 Open-Source Entertainment Hub Released
After a year of development, the award-winning Kodi cross-platform, media center software is now available with many new additions and improvements.
-
Linux Usage Increases in Two Key Areas
If market share is your thing, you'll be happy to know that Linux is on the rise in two areas that, if they keep climbing, could have serious meaning for Linux's future.
-
Vulnerability Discovered in xz Libraries
An urgent alert for Fedora 40 has been posted and users should pay attention.
-
Canonical Bumps LTS Support to 12 years
If you're worried that your Ubuntu LTS release won't be supported long enough to last, Canonical has a surprise for you in the form of 12 years of security coverage.
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.
-
New Pentesting Distribution to Compete with Kali Linux
SnoopGod is now available for your testing needs
-
Juno Computers Launches Another Linux Laptop
If you're looking for a powerhouse laptop that runs Ubuntu, the Juno Computers Neptune 17 v6 should be on your radar.