Linux / Windows - How to set the $PATH environment variable?

About

The $PATH environment variable is a list of which directories Linux will search for for executable files.

As in DOS, the shell uses the PATH variable to locate a command. PATH contains a list of directories separated by colons: When you enter a command, the shell search it in each of the directories specified in the PATH value trying to find it.

If it can't find it, you'll see a “Command not found” message.

Articles Related

How to manage it?

To manipulate and to change it, refer to this article: Linux - Environment Variable. Below is simple snippet.

See it

[root@ebs121 lib]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

Change it for the session scope

To change your PATH variable to include a directory in a session scope:

[root@ebs121 lib]# export PATH=$PATH:$HOME/bin
[root@ebs121 lib]# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin

You can remark the root bin at the end. It was added.

Of you can add it permanently by adding this line in a shell startup script

Documentation / Reference

  • Bookmark "Linux / Windows - How to set the $PATH environment variable?" at del.icio.us
  • Bookmark "Linux / Windows - How to set the $PATH environment variable?" at Digg
  • Bookmark "Linux / Windows - How to set the $PATH environment variable?" at Ask
  • Bookmark "Linux / Windows - How to set the $PATH environment variable?" at Google
  • Bookmark "Linux / Windows - How to set the $PATH environment variable?" at StumbleUpon
  • Bookmark "Linux / Windows - How to set the $PATH environment variable?" at Technorati
  • Bookmark "Linux / Windows - How to set the $PATH environment variable?" at Live Bookmarks
  • Bookmark "Linux / Windows - How to set the $PATH environment variable?" at Yahoo! Myweb
  • Bookmark "Linux / Windows - How to set the $PATH environment variable?" at Facebook
  • Bookmark "Linux / Windows - How to set the $PATH environment variable?" at Yahoo! Bookmarks
  • Bookmark "Linux / Windows - How to set the $PATH environment variable?" at Twitter
  • Bookmark "Linux / Windows - How to set the $PATH environment variable?" at myAOL
 
linux/path.txt · Last modified: 2012/01/27 10:36 by gerardnico