3

I've export PATH="~/.composer/vendor/bin/lumen" in .bashrc and .bash_profile after export then lumen command not working, Rasel Khan:~$ lumen lumen: command not found But if command type ~/.composer/vendor/bin/lumen in terminal then working, i want only when lumen command type in terminal then exactly same as screenshot. how can i fix this ?

see screenshot enter image description here

5

Your problem will not be solved simply by unsetting PATH, as 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.

9
  • thanks, i've now default system, but i want to working this comman dexport PATH="$PATH:~/.composer/vendor/bin/lumen , how can i fix this so when command type lumen in terminal and with working – Rasel Khan Jun 16 '15 at 7:19
  • still not working others command, i want reset default – Rasel Khan Jun 16 '15 at 7:21
  • any command not working like ls........etc, i want to remove only this path export PATH="~/.composer/vendor/bin/lumen" in ` .bashrc` and .bash_profile – Rasel Khan Jun 16 '15 at 7:27
  • See my edited remarks above. I hadn't noticed earlier that lumen was the name of your binary, not the name of the directory containing your binaries. – kommutator Jun 16 '15 at 7:28
  • still lumen command not working, see install lumen lumen.laravel.com/docs/installation – Rasel Khan Jun 16 '15 at 7:34
2

Exec this to get your system default:

grep _PATH /etc/login.defs 
1

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 export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games to fix it for the current session.

"Protip :D :D" if you want to check for your own programs in a directory "/home/username/foo/bin", just add this way to your PATH and you will be able to call the programs stored there just by their names

Hope it helps :)

4
  • And for your question above, to unset a variable use unset PATH but this will NOT help you in this case – IcyIcyIce Jun 16 '15 at 7:40
  • see my screenshot and update in original post – Rasel Khan Jun 17 '15 at 7:09
  • i've alias setup then working as well Rasel Khan:~alias lumen="~/.composer/vendor/bin/lumen" – Rasel Khan Jun 17 '15 at 7:13
  • You need to set your PATH back to what I've told you, AND ADD your path. so it should look like export PATH="/usr/<all in post above>:Lumenpath". And also, Lumenpath isn't the path to the executable lumen, but to the directory where you expect to find lumen – IcyIcyIce Jun 17 '15 at 13:26
1

The command could not be located because '/bin' is not included in the PATH environment variable.

This error means you overwrite your default path with the added PATH vairable above.

How to restore the old PATH?

The default PATH variable is defined in /etc/environment.

To restore the default PATH first delete the add line export PATH="~/.composer/vendor/bin/lumen" from your .bashrc

Then save and source using command:

source .bashrc 

then delete from .bash_profile then save and source:

source .bash_profile

Now source /etc/environment to restore the default path

source /etc/environment

Now your default PATH is restored, you can check by running echo $PATH

Adding new path to PATH variable

Now to add a new PATH use:

export PATH=$PATH:$HOME/.composer/vendor/bin/

EDIT: The error here raises because we add the binary itself so check the above line

Add the line to .bashrc then save and source:

source .bashrc

Check running $PATH you should see your new added path.

9
  • not working this command – Rasel Khan Jun 16 '15 at 7:14
  • Check the update – Maythux Jun 16 '15 at 8:05
  • after adding in .bashrc file Rasel Khan:~$ lumen lumen: command not found, Rasel Khan:~$ echo $PATH /home/khan/.nvm/v0.10.36/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/khan/.composer/vendor/bin/lumen – Rasel Khan Jun 17 '15 at 6:51
  • lumen is the binary? – Maythux Jun 17 '15 at 6:55
  • Check the edit please – Maythux Jun 17 '15 at 6:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.