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

With McFly, your history becomes more accessible. Sadly, without the option to take us back to the future.

Regex parser

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Ardour 5

    The fifth generation of the free Ardour digital audio workstation is easier to operate, offers more Lua support, and comes with a variety of improvements and extensions.

  • Giada

    Giada is a small piece of musical software that can be used in many ways. Mainly designed for working with loops, Giada also can be used as a drum machine or be flexibly integrated into your workflow, thanks to VST and MIDI support.

  • PulseEffects

    A wildly flashing equalizer once was part of the basic equipment of every decent stereo system. PulseEffects upgrades the PulseAudio server to include these slide controls – and offers even more.

  • FOSSPicks

    Sparkling gems and new releases from the world of Free and Open Source Software.

  • LMMS

    Linux has truly started to compete with Windows and MacOS as a platform for professional sound applications. Linux Multimedia Studio (LMMS) is a Linux sound tool that packs a variety of impressive features into a neat bundle.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News