Whenever I try basic commands in the terminal like sudo or ls, I get this error:
Command 'sudo' is available in '/usr/bin/sudo' The command could not be located because '/usr/bin' is not included in the PATH environment variable. sudo: command not found
When I type in echo $PATH, it returns
/Downloads/stata installation/stata15:/Downloads/stata
I suspect I messed up the $PATH variable when trying to install Stata.
I've tried export PATH="/usr/bin:$PATH" which fixes the problem temporarily (from this answer). Then when I do echo $PATH, it returns
/usr/bin:/Downloads/stata installation/stata15:/Downloads/stata
But this fix is temporary and when I restart the terminal, I can't use sudo again.
This other answer says that I can make a permanent fix:
First, I did export PATH=$PATH:/usr/bin, and which again fixes the problem temporarily. When I do echo $PATH, it returns
/Downloads/stata installation/stata15:/Downloads/stata:/usr/bin
Then I'm supposed to be able to make it permanent by editing the /etc/environment file with sudo nano /etc/environment and making sure that it is
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
When I open the /etc/environment file, it already has that exact path, so nothing is changed. So when I restart the terminal, basic commands like sudo still doesn't work and I have to do the temporary fix again.
I suspect that the /etc/environment file is not the issue and there is another file that I need to change. Do you happen to know how to fix it?