The Most Fun (and Useful!) Shell Command

I love when a fellow programmer introduces me to a new tool that significantly improves my workflow. By sharing the tools I use on a daily basis, I hope I can improve your workflows as well.

Have a tool you want to share with me? Hit me up in the comments or shoot me an email.

If you work in a shell environment, you are probably familiar with the feeling of rage that appears when you repeatedly mistype commands, forget arguments, or skip steps in a workflow.

Luckily there is a magical tool to help you fix your mistakes and vent your frustration at the same time: thefuck.

Forgot to add sudo? simply type fuck and you will be on your way. Didn't set the upstream to a git branch before trying to push? fuck will handle all that for you, too:

➜ git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

git push --set-upstream origin master

➜ fuck
git push --set-upstream origin master [enter/↑/↓/ctrl+c]
Counting objects: 9, done.

The best part is that you can add modules for your own commands, though I have not needed to experiment with that yet.

thefuck has significantly improved my workflow - typing fuck to correct a command is now muscle memory, and my frustration has significantly diminished.

Improve your shell hacking here: