Home / Linux / How to remove PATH variable on Ubuntu

How to remove PATH variable on Ubuntu

the PATH stores all the places where the terminal looks for your applications/scripts etc… If you set the PATH to some “unfriendly” directory, the system will not be able to find /bin/sudo and others. You will have to type the whole path like /bin/sudo. The best way to fix this is to open your bash_profile and insert this line:

export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games 

I think changing the profile will work just after the next reboot, so do this and after that use the command


to fix it for the current session.

You’ll still be left without a PATH that includes the necessary system directories. When you set your own PATH, in most cases you will want to append your new entry to the old PATH variable, not replace it entirely, as you have done.

Set your PATH variable back to the system default by typing

export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

and then go edit your .bashrc and .bash_profile to have the correct entry, which will be something like

export PATH="$PATH:~/.composer/vendor/bin"

Notice the variable is set to begin with the existing $PATH. This way, you’ll still have all the original system directories in your PATH, and your addition will be on the end. Also note that I removed lumen from the end of your example, because lumen is apparently the name of the binary you are trying to execute, and your PATH should include only directories containing binaries, not the binaries themselves.

About Rasel Khan

Check Also

How to fix qualified domain name

When you restart your apache server using the command Someone get the following error: Let’s …

Leave a Reply

Your email address will not be published. Required fields are marked *