I was trying to add something to the PATH with :
but I removed all of the content of PATH and I can not run any command on the terminal even ls ! So what should I do ? Can I fix it ?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
Close the terminal app, and open a new one. The variable will be reset to its original state then.
If you're on a virtual terminal, and not running gnome-terminal or similar under X11, then you can log out and log back in again, to reset the variables. You can type
exit to log out, or press Ctrl+D.
In case, the answer by dobey doesn't work for you.
Follow these steps to recover the PATH environment variable :
source /etc/environmentto start reseting the path environment variable
source /etc/profilefollowed by
For you case you could Use command: export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/user/home/sbt/bin
then use command sudo gedit /etc/environment delete whatever it is in then copy and paste this PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/user/home/sbt/bin"
finally run a command source /etc/environment
Now you should be fine