0

I'm trying to install software in Ubuntu 18.10 with sudo apt-get command, but it gave me the error – apt-get: command not found. I used locate apt-get and found that apt-get is located in /usr/bin, which is in the $PATH. It still gave me the error. What should I do?

$ sudo apt-get
sudo: apt-get: command not found
$ locate apt-get
/snap/core/5662/usr/local/bin/apt-get
/snap/core/5662/usr/share/bash-completion/completions/apt-get
/snap/core/5662/usr/share/bash-completion/completions/slapt-get
/snap/core/5897/usr/local/bin/apt-get
/snap/core/5897/usr/share/bash-completion/completions/apt-get
/snap/core/5897/usr/share/bash-completion/completions/slapt-get
/snap/core/6130/usr/local/bin/apt-get
/snap/core/6130/usr/share/bash-completion/completions/apt-get
/snap/core/6130/usr/share/bash-completion/completions/slapt-get
/usr/local/bin/apt-get
/usr/share/bash-completion/completions/apt-get
/usr/share/bash-completion/completions/slapt-get
/usr/share/man/de/man8/apt-get.8.gz
/usr/share/man/fr/man8/apt-get.8.gz
/usr/share/man/it/man8/apt-get.8.gz
/usr/share/man/ja/man8/apt-get.8.gz
/usr/share/man/man8/apt-get.8.gz
/usr/share/man/nl/man8/apt-get.8.gz
$ echo $PATH
/home/guan/anaconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin
:/bin:/usr/games:/usr/local/games:/snap/bin
  • It's really weird that you have your "snapshot" folder in your PATH? Did you manually add it? - I'd remove that might cause really weird things like what you're experiencing. If nothing have you tried running apt-get calling with the full path? /usr/bin/apt-get – Ziazis Jan 9 at 10:02
  • I didn't add anything manually into PATH. I tried to use full path of apt, it didn't work either. – Guan Jan 9 at 10:15
  • Output of ls -l /usr/bin/apt-get ? – xiota Jan 9 at 10:16
  • Here is the result of ls -l /usr/bin/apt-get -rwxr-xr-x 1 root root 134968 12月 8 2016 /usr/bin/apt-get – Guan Jan 9 at 10:25
  • By default, sudo on Ubuntu doesn't use PATH, it uses its own secure_path: what is the output of sudo /bin/grep -r secure_path /etc/sudoers{,.d} ? – steeldriver Jan 9 at 13:46

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.