Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

New at programming here. I couldn't find this when I searched google and SO, but I was wondering what programmers mean when they say "put X in your path." Is this the usr/bin?

Any other resources I can read up on to understand this?

Thank you!

share|improve this question

migrated from Dec 14 '10 at 14:22

This question came from our site for professional and enthusiast programmers.

Path of a Samurai – khachik Dec 14 '10 at 14:05

They usually mean to

  • put your script or executable in one of the directories listed in the PATH environment variable, as shown by echo $PATH.

  • or modify said variable to contain the directory where you script/program/application is

The PATH variable contains a list of colon (:) separated directories to be searched for programs to execute. For example:

$ echo $PATH

You could put your program in e.g. /usr/local/bin, so that it will be detected by other programs without you having to explicitly tell them to look at e.g. /home/user/apps/MyApp.

Alternatively, you could modify that variable to contain /home/user/apps/MyApp. For a single bash shell session, this would do:

$ export PATH="$PATH":/home/user/apps/MyApp

To do it permanently for bash you have to enter this line (without the $ shell prompt) in ~/.bashrc or ~/.bash_profile (or both).

If you have another shell (bash is the default for most Linux distributions) the commands above should be changed accordingly.

share|improve this answer

Well, here is a link by LINFO (The Linux Information Project) :

It explains to you what it is, how you get it, how you change it, well, everything you need to know about it :)

share|improve this answer
+1 for the new (unregistered?) superuser user! Hope the transition will go fine. – Johannes Schaub - litb Dec 14 '10 at 14:10

Path is the name of an environment variable in an operating system. Linux, Unix, DOS, Windows and other operating systems have this concept. The Path environment variable defines the folders to be searched for a command or application to be executed. Hence, if X is the folder which contains your command or application, by adding X to your Path, it allows command, scripts or applications in X folder to be executed by just typing its name alone.

Try this "echo $PATH"

To add X (e.g. /home/x) to $PATH, type


In Linux or Unix, folders are separated by colon (:) while in Dos, Windows, etc, folders are separated by semi-colons (;)

share|improve this answer
It also depends on your shell. For BASH use 'export PATH=$PATH:/home/x' - if you don't do this then the PATH is not propogated to any other shells. For CSH 'setenv PATH $PATH:/home/y' (you may need to escape ':' as '\:' – DanS Dec 14 '10 at 14:18

The path is a colon-delimited list of directories that contain executables and libraries. When you run a program, for example bash, all the directories in the path get checked for a program named bash. In my case, it's inside /bin.

$ echo $PATH
share|improve this answer

When executing a program from the command line, the shell look in many directories to find the program. The list of directory to lookup is defined in a variable named PATH. You can print the content with echo %PATH% on Windows and echo $PATH on Linux and other Unix derived OS.

So when you see path X in you path, it means that you can copy X into one of the directory listed in that variable, or you can change the PATH variable to contains the directory where X is located.

share|improve this answer

You must log in to answer this question.