If, when working on your Linux servers, you occasionally mistype a command and then curse, you might feel right at home with a very oddly named Linux command. It might even reduce the frustration you feel by helping you to correct your typing mistakes. The tool is called, well, thef?ck — but with the ? replaced by the obvious letter. And, in spite of its rather off-color name, a lot of people are very excited to have a little help getting past their command line mistakes. Installing the command The commands shown below should get the command installed on your system. The pip command helps install Python packages. $ sudo yum install pip $ which pip $ PATH=$PATH:/usr/local/bin $ wget -O - https://raw.githubusercontent.com/nvbn/thefuck/master/install.sh | sh - && $0 $ sudo -H pip install thefuck And, to ensure that I behave myself on the command line (who knows who might end up reading my history file), I created an alias for the f?ck command. $ alias fix=/usr/local/bin/f?ck Just don’t forget to replace the ? as described above. OK, so from now on I can call the command “fix”. Let’s take a look at what fix can do for you. Using the fix alias First, let’s make a mistake and see what happens. I’ll deliberately misspell a command argument. $ cd /usr/lcal/bin -bash: cd: /usr/lcal/bin: No such file or directory Then, I type “fix” to get a little help. $ fix mkdir -p /usr/lcal/bin && cd /usr/lcal/bin [enter/↑/↓/ctrl+c] Aborted OK, so maybe that wasn’t the help I was hoping for, but the suggested command change would have worked; it just wouldn’t have done the smartest thing (i.e., take me to the intended but misspelled subdirectory). So, I hit control-C instead and aborted the replacement command. Of course, in this case, if I’d blindly pressed the enter key for this command, I would have received a “cannot create directory” error since I don’t have write permission to /usr/local/bin. Sometimes the fixes suggested by fix work out well and sometimes they don’t. When I mistype a command name, I get a better suggestion. $ sdo vim /etc/passwd -bash: sdo: command not found $ fix sudo vim /etc/passwd [enter/↑/↓/ctrl+c] In this case, the fix command is probably only slightly faster than editing the command by typing ^s^su^. Sometimes fix helps a lot, sometimes only a little. Here are a couple examples using the fix command for date misspellings: . $ datee -bash: datee: command not found $ fix date [enter/↑/↓/ctrl+c] Tue May 10 19:04:28 EDT 2016 $ daet -bash: daet: command not found $ fix date [enter/↑/↓/ctrl+c] Tue May 10 19:04:41 EDT 2016 The fix command won’t always suggest the command that you had in mind –- as shown in the following example. $ aptget install netcat -bash: aptget: command not found $ fix date install netcat [enter/↑/↓/ctrl+c] date: extra operand ‘netcat’ Try 'date --help' for more information. $ aptg-et install netcat -bash: aptg-et: command not found $ fix gpg-agent install netcat [enter/↑/↓/ctrl+c] You can also get some interesting effects when using fix. In the command sequence below, we can see that “fix” makes use of commands that I’ve entered in the past. Though my echo command was perfectly valid, the fix that follows yanks a command from my history file. $ echo Hello, World! Hello, World! $ fix echo Hello, World! | rev [enter/↑/↓/ctrl+c] !dlroW ,olleH One caution One caution is in order. If you use the “fix” command (or the command by its original name), always verify that the suggested command is the one you had intended to type. Some people have reported f?ck confusing itself for fsck. The fsck command is clearly one you don’t want to run by mistake. I haven’t run into that though I see it does, as I’d expect, try to fix misspellings of fsck. $ fcsk -bash: fcsk: command not found $ fix fsck [enter/↑/↓/ctrl+c] Wrap-Up The “fix” command is clearly one of more unusual commands that I’ve come across, though it’s one that at least was put together with a good intention or two – maybe both to fix your mistakes and give you a chance to let off just a bit of steam. Related content how-to How to find files on Linux There are many options you can use to find files on Linux, including searching by file name (or partial name), age, owner, group, size, type and inode number. By Sandra Henry Stocker Jun 24, 2024 8 mins Linux opinion Linux in your car: Red Hat’s milestone collaboration with exida With contributions from Red Hat and critical collaborators, the safety and security of automotive vehicles has reached a new level of reliability. By Sandra Henry Stocker Jun 17, 2024 5 mins Linux how-to How to print from the Linux command line: double-sided, landscape and more There's a lot more to printing from the Linux command line than the lp command. Check out some of the many available options. By Sandra Henry Stocker Jun 11, 2024 6 mins Linux how-to Converting between uppercase and lowercase on the Linux command line Converting text between uppercase and lowercase can be very tedious, especially when you want to avoid inadvertent misspellings. Fortunately, Linux provides a handful of commands that can make the job very easy. By Sandra Henry Stocker Jun 07, 2024 5 mins Linux PODCASTS VIDEOS RESOURCES EVENTS NEWSLETTERS Newsletter Promo Module Test Description for newsletter promo module. Please enter a valid email address Subscribe