Command not found for every command in Ubuntu
How to fix this error while doing some changes in .bashrc file I messed up something and
now for each command execution this error coming like “command not found” as shown in Image – 1
Image – 1
To overcome this issue we need to add path to the PATH variable. all user commands are located in
/bin and /usr/bin or /usr/local/bin directories. all programs are installed in these directories.
export PATH=$PATH:/bin:/usr/local/bin
Execute above command to add path to PATH variable.
and now if you do ls or type any command it wont show “command not found” error.
Still if you reboot the machine again it will show the same error.
To fix this issue permanently we need to add the location to .bashrc file
so that this issue does not comes up again. To add the default location of all the directories
in the PATH variable which contains all the executable files in Linux in .bashrc file.
#sudo nano ~/.bashrc
Go to end of the file and add this line
export PATH=$PATH:/bin:/usr/local/bin
Save and exit from the editor.
Now if you reboot the machine also you will not get that error while executing any command in terminal.
You might like:
How to install nginx, mysql, phpmyadmin, php in Ubuntu
How to install .deb file in Ubuntu
How to resolve network wifi issue in Ubuntu 16.04 LTS