Linux Add path to $path

Last updated:

LINUX

Gotcha

The /etc/profile is executed only for interactive shells and the /etc/bashrc is executed for both interactive and non-interactive shells. In fact in Ubuntu the /etc/profile calls the /etc/bashrc directly.

Temporarily

export PATH=/home/dave/work:$PATH

For your self only

Add the export command above to .bashrc or .profile

Permanent for all users

Add export to /etc/profile file and /etc/bashrc

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

references:

  1. Understanding a little more about /etc/profile and /etc/bashrc - Benjamin Cane (bencane.com)