Ubuntu – Keep getting message `404:: command not found` everytime opening terminal

bashcommand line

I just realized that I keep getting message 404:: command not found every time I open terminal. I don't remember what I installed right before getting this message:

enter image description here

I can't find it in any of bash's startup files:

$ grep 404 -H ~/.bashrc ~/.profile ~/.bash_profile ~/.bash.login \
              ~/.bash_aliases /etc/bash.bashrc /etc/profile  \
             /etc/profile.d/* /etc/environment 2> /dev/null
$

I also ran PS4='${BASH_SOURCE}:${LINENO} ' bash -lxe, you can find the full output can be found here.

Best Answer

This part of your bash -lxe output:

///usr/share/bash-completion/bash_completion:1981 . /etc/bash_completion.d/docker-compose
////etc/bash_completion.d/docker-compose:1 404: Not Found
////etc/bash.bashrc:57 '[' -x /usr/lib/command-not-found ']'
////etc/bash.bashrc:58 /usr/lib/command-not-found -- 404:
404:: command not found
////etc/bash.bashrc:59 return 127

reads to me that you have a /etc/bash_completion.d/docker-compose that starts off with 404:. I'm guessing at some point you tried to download that configuration file from somewhere and instead wound up saving an HTTP error message.

That file should be plain text; you can use your preferred text editor on it (you should need to use sudo/sudoedit/etc. to modify it).

PS: I suggest in the future you review downloaded files before installing them—not only to notice error messages, but also to see what they do (especially important if you don't fully trust the site its coming from, or if its served over HTTP instead of HTTPS), and if there is any customization needed for your particular setup.

Related Question