Original: Taste of Little Sister (wechat official ID: XjjDog), welcome to share, please reserve the source.

There is a command on Linux, with the most primitive impulse of animals, from the beginning of its appearance on Github, it has gained the attention of countless fans, and now has 60K + star number.

The haloed command is Fuck, Vak of Czechoslovakia. This word is mainly used to describe the feeling of anger in your heart when you have done something badly or made some stupid mistake.

To view the markdown brain map online, visit Mind.xjjdoc.cn

Seeing is believing, so let’s see what it is.

That’s good, that’s good, that’s what the picture is about. It allows us to go off the track and get back on the track, which is pretty magical.

For example, if you forget the git branch switch command and type something like this. This is a common thing for some English illiterates.

git brnch
Copy the code

What the hell is BRNCH? Why aren’t my hands listening to my brain? Fuck! When you think that, and you do, the FUCK command corrects you.

Fuck Git branch [Enter /↑/↓/ CTRL + C] * masterCopy the code

It proves that on Linux, there’s nothing that can’t be solved in one shot.

1. How do I install it?

The fuck command is a Python program, so we can install it using PIP.

pip3 install thefuck
Copy the code

Then, add a line under.bashrc or.zshrc (your $SHELL).

eval $(thefuck --alias)
Copy the code

So let’s test that out. Input ystemct

>> ystemct
zsh: command not found: ystemct
Copy the code

We can modify this to systemctl by typing fuck.

Fuck can do anything except correct spelling mistakes.

  • Forgot to add sudo to execute some super permission commands, which can be resolved
  • Fuck it, too, when some obvious parameter input is wrong

It works, doesn’t it? But beefcake doesn’t need the FUCK command.

According to? We need to see how it works.

2. How it works

Did the fuck command read my brain waves and eavesdrop on my thoughts? To identify exactly what I want to see?

This is magic. It should be deep learning, where common input errors and solutions are learned by force.

But no.

In the thefuck/ Rules directory, there are hundreds of rules lying quietly. The so-called rule is the white list.

The Git command alone gives dozens of matches, so it can be said that the FUCK command does a lot of work on common commands.

So, you can create your own rules. Implement both methods and put them under ~/.config/thefuck/rules.

match(command: Command) -> bool
get_new_command(command: Command) -> str | list[str]
Copy the code

It’s still very convenient.

3. Don’t form attachments

But beefcake never uses the fuck command.

The rules, the corrections, are all in the buff’s head.

The intelligence of fuck command is not real intelligence, it is a collection of empirical dogmatism, the exhaustion of rules, the collection of limitations.

Every command input is a test. When this test becomes a mental reflex, the fuck command becomes dispensable and becomes a joke. Fuck command, is a kind of mental decay, is the delusion of using tools to achieve intelligence. You don’t need to be secretive, coy, straight to the point is the real macho man.

As a result, it took less than two minutes to install and uninstall the FUCK command.

Xjjdog is a public account that doesn’t allow programmers to get sidetracked. Focus on infrastructure and Linux. Ten years architecture, ten billion daily flow, and you discuss the world of high concurrency, give you a different taste. My personal wechat xjjdog0, welcome to add friends, further communication.