Juha-Matti Santala
Community Builder. Dreamer. Adventurer.

Better bash history search with McFly

If there's one functionality of bash that most beginners don't know but get very excited about when they discover it, it's history. First you learn to go through the history by pressing up and down, then you find out that CTRL+R is the spell that gives you access to write commands and find them from history.

I'm a huge fan of that. Probably 80-90% of my bash command history is repeating commands over and over again. Whether it's npm install, npm run start, git add . or something similar, I can find it from my history.

But the built-in search isn't always the optimal one. You can't really see the history: you have to know what you're looking for. Luckily, developer community is amazing and Andrew Cantino has built a tool to augment your bash history.

Meet McFly. Great Scott!

Screenrecording of bash shell using mcfly to read through history, re-run commands and edit commands

Instead of being faced with blank black prompt, you get nice visual view of your history. You can search by writing a part of the command, you can navigate with arrow keys and either run (ENTER) or edit (TAB) your commands.

It also features a smart system that takes into account certain things to be more relevant: in which directory you are, what's the context of the command, if the command has failed or not, etc.

In the beginning, mcfly felt a little bit slower because it takes a moment to start up. But after using it a while, I don't want to go back to guessing game.
Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment.

Syntax Error

Sign up for Syntax Error, a monthly newsletter that helps developers turn a stressful debugging situation into a joyful exploration.