2

Every time I mistype a command such as cd.. (e.g. I forgot to separate cdand .. with a space) the command prompt disappears and I can no longer use commands in the terminal unless I close and reopen it:

[user@Host Downloads]$ cd..
bash: cd..: command not found...


cd ..
exit
q 
man                             
aaaaaa      
bash

Why does the command prompt stop working and how do I exit this state without restarting the terminal?

16
  • 2
    We might be able to fix it more permanently if you're interested in getting to the bottom of it...?
    – Jeff Schaller
    Commented May 15, 2018 at 17:20
  • 3
    Could you please update the question with the output of the commands that people asks you to try (including my suggestion with set -x)?
    – Kusalananda
    Commented May 15, 2018 at 17:30
  • 2
    Just to clarify: I don't consider pressing Ctrl+C when this happens a solution to this issue.
    – Kusalananda
    Commented May 15, 2018 at 18:12
  • 2
    As to why this is happening; there is a package called 'command-not-found' (that's its name in debian) that puts a hook into your shell and attempts to locate, download, and install commands whenever you type something that bash cannot find in the PATH. It tends to be slow. Disable it. Commented May 15, 2018 at 18:21
  • 2
    It's not a solution, it's a band aid, since it doesn't stop it from happening again. It is not the way a shell should behave. See mattdm's answer, which is just a guess and a stab at possibly alleviating it. By helping us diagnose it, we might be able to solve it properly.
    – Kusalananda
    Commented May 15, 2018 at 20:44

1 Answer 1

2

There is a feature enabled by default which attempts to search for uninstalled packages which might provide the command you typed. This should be very fast, but it seems like for some reason on your system, it is not.

There are several things one could do to diagnose that, but to just solve the immediate problem, you can disable that feature with

sudo dnf remove PackageKit-command-not-found
2
  • Oh I see so your telling me that behind the scenes this feature is still searching which might explain why I was still able to use the terminal instead of it just freezing, but in my case I waited probably over 10 minutes and the PS1 command prompt didn't return. Isn't this odd?
    – bit
    Commented May 15, 2018 at 20:47
  • Yes, and yes, definitely odd. What does pkcon refresh do?
    – mattdm
    Commented May 15, 2018 at 20:53

Not the answer you're looking for? Browse other questions tagged .