Cool idea. For those systems where you don't have the option of adding a 3rd party tool, it's probably worth knowing some of the standard bash shortcuts. The easy to remember ones are:<p><pre><code> !^ - the first argument from the previous command
!$ - the last argument from the previous command
!* - all of the arguments from the previous command
!! - the entire previous command
</code></pre>
For example:<p><pre><code> $ apt-get install foo
# Crap
$ sudo !!</code></pre>
An issue that popped up for a user, kind of funny:<p><a href="https://github.com/nvbn/thefuck/issues/1" rel="nofollow">https://github.com/nvbn/thefuck/issues/1</a><p><pre><code> who@where:~$ fuck
No fuck given
who@where:~$ fuck
fsck from util-linux 2.20.1
e2fsck 1.42.9 (4-Feb-2014)
/dev/sda6 is mounted.
WARNING!!! The filesystem is mounted. If you continue
you ***WILL*** cause ***SEVERE*** filesystem damage.
Do you really want to continue<n>? no
check aborted.</code></pre>
Git already has a config to do this:<p><pre><code> help.autocorrect
Automatically correct and execute mistyped commands after waiting for the given number of deciseconds (0.1 sec).
If more than one command can be deduced from the entered text, nothing will be executed. If the value of this option is negative, the corrected command will be executed immediately.
If the value is 0 - the command will be just shown but not executed. This is the default.
</code></pre>
<a href="http://git-scm.com/docs/git-config" rel="nofollow">http://git-scm.com/docs/git-config</a>
Zsh's completion system handles most of those examples if enabled:<p><a href="http://zsh.sourceforge.net/Guide/zshguide06.html#l162" rel="nofollow">http://zsh.sourceforge.net/Guide/zshguide06.html#l162</a><p><a href="http://zsh.sourceforge.net/Doc/Release/Shell-Grammar.html" rel="nofollow">http://zsh.sourceforge.net/Doc/Release/Shell-Grammar.html</a><p><a href="http://zsh.sourceforge.net/Doc/Release/Expansion.html" rel="nofollow">http://zsh.sourceforge.net/Doc/Release/Expansion.html</a><p>It can actually be integrated into history expansion, used at will, configured with a custom prompt, told to ignore certain words and files that annoy you, etc. But if you try to search for "zsh correction", most posts are related to disabling it entirely.
I think it's a funny little app. I could see it being kind of useful for the author but I think I would personally have trouble using an app that I don't actually know what it's going to do 100%. I think that you could mitigate this a bit by putting the list of commands it corrects right at the top of the readme.<p>I think most of us have probably been at the point where we were typing something like "I hate you, you god damn computer!" into the terminal or text editor. I see this as a moderately elegant helper in those situations
"In one notorious incident, Warren added a DWIM feature to the command interpreter used at Xerox PARC. One day another hacker there typed delete <i>$ to free up some disk space. (The editor there named backup files by appending $ to the original file name, so he was trying to delete any backup files left over from old editing sessions.) It happened that there weren't any editor backup files, so DWIM helpfully reported </i>$ not found, assuming you meant 'delete *'."
See <a href="http://www.catb.org/jargon/html/D/DWIM.html" rel="nofollow">http://www.catb.org/jargon/html/D/DWIM.html</a> and also <a href="https://en.wikipedia.org/wiki/DWIM" rel="nofollow">https://en.wikipedia.org/wiki/DWIM</a>
I wrote a similar Sudo History Invocation Tool to do this: <a href="https://github.com/christianbundy/shit" rel="nofollow">https://github.com/christianbundy/shit</a>
What I really want is a wrapper for sudo.
Whenever I use sudo, if type the password correctly it works instantly; if I mistype the password, it delays for 2 seconds before asking again. Often it's faster to Ctrl+C UP ENTER than to wait for that annoying 2 seconds. So it would be nice if a wrapper existed to see if sudo gives access within 0.1 seconds, and if it doesn't, assume the password was wrong, kill the sudo process and launch the command again. Automate the Ctrl+C UP ENTER.
I've started to wonder why we've never seen a more IDE-like autocomplete in consoles. I mean, why do I have to use man pages and all sorts of reference guides to remember the parameters for find or grep or whatever, or the order of commands for whatever?<p>There really needs to be better communication between software and the environment it's running in.
Projects like this always make me think the developer's imagination has drastically failed them with respect to the scope of negative consequences that may result from using their tool.
Added the `fuck --dry` option from the comments below, waiting for it to be merged.<p>All it does is print the command to run and prompts for [Y/n].
Issue #1 is classic.<p>Running 'Fuck' twice attempts to evaluate the previous 'Fuck'- and returns 'fsck' - which tries to forcefully check your mounted drive.<p>I wouldn't trust this app for practical use.
Got to love
<a href="https://github.com/nvbn/thefuck/issues/5" rel="nofollow">https://github.com/nvbn/thefuck/issues/5</a>
I think i will continue using the Fish shell feature instead. It has this awesome feature of autocompleting your command with the bash history of yours.<p>It is safe because it will autocomplete a command that you wrote before.<p>Another cool thing with it is that, it will list the commands that you can run after entering a word. It does this by reading the man page of the command you write.<p>brew <Tab> will list the brew commands for you to use with its explanations.
I will not let my coworkers see me typing expletives into terminal; much less if it is a woman.<p>It is a nice idea, though. Will use it if it's called auto-correct or something.
Made an Arch AUR package. First time making VCS package. Might be terrible.<p><a href="https://aur.archlinux.org/packages/thefuck-git/" rel="nofollow">https://aur.archlinux.org/packages/thefuck-git/</a>
I'm not quite sure I understand why this is any better than using the up arrow.<p>I thought the cardinal rule of sysadmins was "think before you press enter". This seems to discourage that mindset.
I just keep getting "No host name on command line, aborting."<p>Also was asked to install "suck." Not sure why / what that is.
I've created perl scripts for fuck, shit, and goddamnit. they merely echo an array slice to the terminal, from a list of about 30 phrases. had 'em for about 15 years now.<p><pre><code> <root@ButtPirate>$ fuck
I hope this computer dies of ass cancer.
</code></pre>
always makes me feel a little better about life. this app might be more effective, though.
yea, lots of us use shells with suggestive text...that doesn't make this less amusing. Now if only someone would make rules for my osx terminal, thatd be great
I'm going to go out on a limb here and suggest that you rename it "The Fix." Then you could type "fixit" or just "fix".
I'd not use this.<p>It's basically a negative, aggressive emotional response, exactly a thing I'd rather not experience while working.<p>A failure due to not enough privileges might be a signal to rethink what you are doing; a mindless prepending of `sudo` is dangerous. Why not `su root` then?<p>Also, there was that screnshot of `sudo wget` as a response to a 403 error. This is exactly why you should re-examine a failed command instead of swearing around.