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
$ echo $PATH
  • 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.