DEV Community

Cover image for The F*ck - A Really Helpful Command Line Tool 💻
Niall Maher
Niall Maher

Posted on

The F*ck - A Really Helpful Command Line Tool 💻

Giving a f*ck might actually save you time! 😂

If you want a video version of this guide:


Or else continue reading. 🧑🏻‍💻

This tool makes me laugh and makes me faster with the command line tools so it's a win-win.

Today we will look at "The F*ck" which is a super helpful CLI tool that lets you use those suggested commands in the terminal without having to retype everything again.

Have you ever had that frustrating moment where you type a wrong command, something like grabbing a new branch with git?

Mistyping git branch in terminal

But git from that nice suggestion there already knew what we meant so instead we think "f*ck", and start to type out what we really meant. But thanks to this CLI tool we can just type fuck and it gives us the suggested command and execute it for us.

Saving the day with fuck

So this works with a variety of tools and has a really good matching sequence which you can check out in more detail in their documentation here.

If you are using a Zsh terminal like myself you may need to add an alias to get it working as I have above (or if you want something a little more suitable for work it's always an option too but there's no fun in not typing "fuck" as you mistype).

You can install it on Windows with pip and there are a few alternative install guides for Mac and Linux in the docs here:

🔗 https://github.com/nvbn/thefuck

Demo of The Fuck working

What do you think of The Fuck?

Are you enjoying adding it to your workflow as much as me?


This video was inspired by Daan's awesome article here:
🔗 https://levelup.gitconnected.com/7-command-line-tools-that-make-your-life-easier-d69c38850d6c


Follow me on Twitter

Subscribe on Codú Community

Top comments (21)

Collapse
 
calag4n profile image
calag4n • Edited

Hum, it seems pretty fun though if you use oh-my-zsh together with zsh , you've got a really helpful historic suggestions as you type any character, then just press up to see others commands that you have already enters and begins by the same letters.
This became essential to me , if you don't know yet, I suggest you to try it out .

However, F*ck seems to be useful for the commands that you have never entered.

Collapse
 
nialljoemaher profile image
Niall Maher

I never saw oh-my-zsh before, this looks awesome, I am going to test it out now! Cheers for the tip. ❤️

Collapse
 
timmybytes profile image
Timothy Merritt

It is absolute magic. Plugins for days and the best CLI experience I’ve ever had. Highly recommend using autojump alongside fuck

Thread Thread
 
nialljoemaher profile image
Niall Maher

Dang that's a cool recommendation too! Cheers ❤🤘

Collapse
 
madza profile image
Madza

I imagine using this tool for like 5 years and then going to on-site interview and institutively saying out the word loud after I mistaken JS array methods slice vs splice 😂😂😂

Collapse
 
nialljoemaher profile image
Niall Maher

Maybe a SFW alias is required 😂

Collapse
 
madza profile image
Madza

Hahah, exactly 😂😂

Collapse
 
kretaceous profile image
Abhijit Hota

I'm pretty sure I'd misspell fuck too.

Collapse
 
thormeier profile image
Pascal Thormeier

Executing it again apparently skips all unsuccessful attempts and jumps straight to the last command that is not a typo of fuck:

user@~ $ lls -la
bash: lls: command not found
user@~ $ fcuk
bash: fcuk: command not found
user@~ $ fkuc
bash: fkuc: command not found
user@~ $ fuuck
bash: fuuck: command not found
user@~ $ fccuk
bash: fccuk: command not found
user@~ $ fuck
ls -la [enter/↑/↓/ctrl+c]
Collapse
 
nialljoemaher profile image
Niall Maher

Dang you are battle testing it anyway! That's pretty neat

Thread Thread
 
thormeier profile image
Pascal Thormeier • Edited

Been battle-testing it for a few months now, definitely the single most important command in my shell :D

But I keep finding new awesome nuances of this tool, I love it!

Collapse
 
kretaceous profile image
Abhijit Hota

How cool is that!

Collapse
 
nialljoemaher profile image
Niall Maher

Me too buddy, me too...

Collapse
 
shubhamzanwar profile image
Shubham Zanwar

This tool deserves all our love!
I've been using it for about a year now and it's just magical.

f*uck --yeah is my favourite thing to type into the terminal 🤘🏽

Collapse
 
nialljoemaher profile image
Niall Maher

I don't know how I missed it for so long to be honest. But yeah, for some reason, super satisfying way of correcting mistakes 😂

Collapse
 
rahmanfadhil profile image
Rahman Fadhil • Edited

Awesome! 🤩

If you're like me, you probably want to have this in your shell configuration.

alias shit="fuck"
Collapse
 
ketanip profile image
KetanIP • Edited

This tool is really useful but as I see the gif it seems really funny 🤣 as if you are writing f*uk in anger. By the way loved it.

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt

Can I abbreviate to f? It would make my life easier.

Collapse
 
nialljoemaher profile image
Niall Maher

There is an alias command to change it to whatever you like so I guess so.

Collapse
 
skylerdevops profile image
Skyler

I shall install it!! Thanks for sharing :)
Just to be sure, it does ask before doing the actual command? (just in case...)

Collapse
 
nialljoemaher profile image
Niall Maher

Yes, will let you go up and down and pick the closest commands it can match (even if there are no matches) so it's safe!