Score:1

Ubuntu 20.04 setting path variable to solve laravel: command not found

in flag

I was following this solution and noticed that it's temporarily working for me. I tried doing

export PATH="$PATH:$HOME/.config/composer/vendor/bin" >> ~/.bashrc

and

export PATH="$PATH:$HOME/.config/composer/vendor/bin" >> ~/.profile

than I did source ~/.bashrc and source ~/.profile to update those files. When I open them in an editor I don't see the new path in either file. However, I'm able to use the laravel command in that instance of terminal where I used those commands, but it doesn't work in any new terminals. How can I make this change to my $PATH permanent?

Score:2
hr flag

>> redirects standard output. The command export PATH="$PATH:$HOME/.config/composer/vendor/bin" doesn't produce any standard output, so nothing gets appended to the file(s).

You probably wanted

echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bashrc

or just

echo 'PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bashrc

since PATH has almost certainly been exported into the environment already.

Also not that the source command does not "update [those] files"; it updates your current shell based on the contents of those files.

Pachuca avatar
in flag
*palm to head* thank you!
Pachuca avatar
in flag
what's the diff between using ``export PATH`` and just ``PATH``?
hr flag
@Pachuca `export VAR` places `VAR` (and its value) into the environment of any child processes started by the shell, whereas unexported variables only exist in the current shell environment. In the case of `PATH`, it's likely already been marked for export early in the session via `pam_env` and doesn't really need to be `export`ed again.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.