Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 3
    Is the file named /etc/profiles with an s on your distro? Mine has no s. I think you have a typo. Commented Oct 16, 2014 at 13:36
  • 4
    You probably want to escape the $ you are writing to the profile file. e.g. echo "export PATH=\$PATH:/path/to/dir" >> /etc/profile, that way you actually append to the variable when that script runs rather than setting it to a literal value based on it's value at the time of executing this initial command. Commented Jan 20, 2016 at 15:12
  • echo "export PATH=$PATH:/path/to/dir" >> /home/<USERNAME>/.bashrc this worked for WSL with Kali distrubution. A new thing got that you can set any variable like echo "export PYTHONPATH=/path/to/dir" >> /home/<USERNAME>/.bashrc for new creation and echo "export PYTHONPATH=$PYTHONPATH:/path/to/dir" >> /home/<USERNAME>/.bashrc this for update. Commented Jun 8, 2022 at 11:20