Wednesday, March 4, 2009

Adding a Directory to the Path

Adding a Directory to the Path

  1. To add a directory to the path of a single user is to modify that user's .bash_profile file.
  2. To add it to all users except user root, add it to /etc/profile.
  3. To also add it to the path of user root, add it to root's .bash_profile file.

Adding to a Single User's Path
To add a directory to the path of a single user, place the lines in that user's .bash_profile file.
PATH=$PATH:/data/myscriptsexport PATH

Adding to All Users' Paths (except root)
You globally set a path in /etc/profile. That setting is global for all users except user root.
PATH=$PATH:/data/myscripts
export PATH

Adding to the Path of User root
User root's path is set from scratch by its .bash_profile script. In order to add to the path of user root, modify its .bash_profile.

For more information, see the full article "Adding a Directory to the Path"

No comments: