I was trying to add something to the PATH with :
export PATH=/user/home/sbt/bin
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 communityClose 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/environment
to start reseting the path environment variablesource /etc/profile
followed by source /etc/profile.d/*
source ~/.bashrc
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
sudo PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
? This will only work for the actual session.cat /etc/environment
in a terminal.