Today there are several hundreds (maybe even thousands) programming languages around (not to mention Domain Specific languages), but bash, with all its shortcoming, is still native language of all *nix servers around.

With today’s choices you might not want to create scripts in bash, for one liners bash is still in.

In this article I want you to pay attention on bash McFly, program that will completely replace very popular Ctrl+R bash shortcuts for searching through the bash history.

McFly will import your history file along with execution status and some other information into a SQLite database.

To install the software, you first need to install another excellent piece of Open Source tool: Homebrew (for Linux also known as Linuxbrew previously).

There are many advantages to install Homebrew, but description of what it does is out of scope of this article.

For details you can take a look at the following link:


If you are on RedHat/CentOS/Oracle Linux/Fedora, here is what you need to do:>sh -c "$(curl -fsSL">sudo yum groupinstall 'Development Tools'>sudo yum install curl file git>sudo yum install libxcrypt-compat # needed by Fedora 30 and up

The only note I have is regarding adding McFly to your PATH.

Although in instructions you can find that you need to execute the following command:

echo 'eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)' >>~/.profile

that is wrong.

Instead you need to execute the following:

echo 'eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)' >>~/.bashrc          

The only difference is that you need to use .bashrc instead of .profile (which is fien for Debian derivates like Ubuntu).

After you finish Homebrew installation, you need to install McFly bash history search software.

Installation process is described on the following link:


In short you need to execute the following commands:>brew tap cantino/mcfly>brew install mcfly

And add the following in the .bashrc file:>vi .bashrc

#McFly replacement for bash Ctrl+R history search
if [ -r $(brew --prefix)/opt/mcfly/mcfly.bash ]; then
  . $(brew --prefix)/opt/mcfly/mcfly.bash

One final step is to re-run the .bashrc file>. .bashrc
McFly: Importing Bash history for the first time. This may take a minute or two...done.

To test if installation passed, you can execute the following:>mcfly -h
McFly 0.3.4
Andrew Cantino <>
Fly through your shell history


    -d, --debug      Debug
    -h, --help       Prints help information
    -V, --version    Prints version information

        --mcfly_history <MCFLY_HISTORY>    Shell history file to read from when adding or searching (defaults to
        --session_id <SESSION_ID>          Session ID to record or search under (defaults to $MCFLY_SESSION_ID)

    add       Add commands to the history
    help      Prints this message or the help of the given subcommand(s)
    move      Record a directory having been moved; moves command records from the old path to the new one
    search    Search the history
    train     Train the suggestion engine (developer tool)

Now I can describe just a couple of features that will make you try to install that wonderfull bash add-ons.

From the help file you can see that tool supports add (to add commands into a history) which is convenient as you can control exactly what commands you want to search for sometimes later.

But the main reason why you want to install McFly is to speed up your terminal manipulations by searching through the history of executed (or added) commands which allows you to be more productive when working in terminal screen.

Unlike standard Ctrl+R bash history search, when you execute Ctrl+R keystroke combination or you enter mcfly search command in the terminal window, search screen takes the entire screen window as you can observe on the following figure:

McFly bash history search (Ctrl+R)

You can see the list of possible options like: ESC – to exit search window, Enter to Run selected command, TAB to edit selected command or F2 to delete selected command from the history.

As you type some letters, McFly will automatically show only history that satisfy entered criteria.

For more advanced usage, you can use the move command to update the database (in case you want to move SVN or Git project to another directory) in a way that all commands that are using old directory will be updated with a new target directory.

There is also train sub command that allows you to train suggestion engine (like prioritization) but that is out of scope of this article.



As Terminal screen and bash are the most fundamental parts of every *nix machine, every addition that will make you more productive and efficient is welcomed.

Although this bash addition will most often be installed on client Linux machine (as per security restrictions), McFly will definitely worth of attention.

Get notified when a new post is published!



There are no comments yet. Why not start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.