You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.9 KiB

Build Status

McFly - fly through your shell history

NOTE: This open source project is pre-alpha. It works-- I'm using it every day-- but I haven't trained the prioritization linear perceptron yet because I'm still gathering training data, so the ordering is suboptimal.



  • Rebinds CTRL-R to bring up a full-screen reverse history search with very smart prioritization.
  • Augments your shell history to track return status, timestamp, and execution directory.
  • Unicode support throughout.
  • Also writes to your existing shell history file so you can stop using McFly whenever you want.
  • Simple command to scrub a history item from the database and shell history.
  • Designed to be extensible in the future for other shells.
  • Written in Rust, so it's fast and reliable.


The key feature of McFly is smart command prioritization. The goal is for the command you want to run to always be one of the suggestions.

When suggesting a command, McFly takes into consideration:

  • The directory where you ran the command. You're more likely to run the same command in the same directory in the future.
  • What commands you typed before the command (e.g., the command's context).
  • How often you run the command.
  • When you last ran the command.
  • The command's historical exit status. You probably don't want to run old failed commands.


Compile it yourself

  1. Install Rust 1.29 or later
  2. Compile with optimizations
    cargo build --release
  3. Copy ./target/release/mcfly into a location in your $PATH. (For example, you could create a directory at ~/bin and add export PATH="$PATH:$HOME/bin" to your .bash_profile.)

Enable in your shell


Add . /path/to/this/repository/ to your ~/.bash_profile or ~/.bashrc file.


To avoid McFly's UI messing up your scrollback history in iTerm2, make sure this option is unchecked:

iterm2 UI instructions

Future / Upcoming Features

  • Add screencast to README.
  • Add keyboard shortcut to delete something from the history / make it not get suggested.
  • Better prioritization:
    • Finish training the linear perceptron after gathering more selection data.
    • Learn embeddings per template and use to predict the next embedding, then do approximate nearest neighbor lookup?
      • Could train by predicting whether or not one command should follow another and doing gradient descent.
  • Learn common command options and autocomplete them in the suggestion UI?
  • Sort command line args when coming up with the template matching string.
  • Allow suggesting of the last command seen if it's been a while.
  • Detect folder renames?