In a linux machine, we may have to compile our programs with respect to that linux machine.

Now, if we already have some other users (not root. A typical user.) who have already compiled many programs for this machine, is it possible to do something like this?

For instance, user oldGuy got mpirun, python, and several other programs in his home directory, and he can invoke "mpirun" or any other binaries in his directory without having to type "./mpirun". Bash knows which binary he is referring to. He also has various other settings done.

Now, suppose we have a new user called newGuy. If in our server, oldGuy already has compiled all the binaries that newGuy wanted, instead of having the newGuy wasting his time compiling programs that oldGuy already has and set everything correctly, can the newGuy "inherit" some binaries, settings, etc. from oldGuy?

For example, oldGuy can simply invoke "mpirun" right from Bash, can newGuy do anything in order to be on the same page (all identical settings) with oldGuy right away, without having to compile the programs and set other settings, etc?


When you execute a program by typing its name (with no directory part, e.g. just mpirun with possible arguments), the system looks for a file by that name in a list of directories called the program search path, or path for short. This path is determined by the environment variable PATH, which contains a colon-separated list of directories, for example /usr/local/bin:/usr/bin:/bin to look first in /usr/local/bin, then /usr/bin, then /bin.

You can add directories to your search path. For example, if joe has installed some programs in his home directory /home/joe with the executables in /home/joe/bin, the following line adds /home/joe/bin at the end of the existing search path:


In most environments, for this setting to take effect, add the line to the file called .profile in your home directory. If that file doesn't exist, create it.

If you log in in a graphical environment, depending on your environment and distribution, .profile may not be read. In this case, look in your environment's documentation or ask here, stating exactly what operating system, distribution and desktop environment you're running.

If you log in in text mode (e.g. over SSH) and .profile isn't read but there is a file called .bash_profile, add the line to .bash_profile.


If you are not willing to just copy the home directory over, or if you have encryption, one option is to install all compiled binaries in a central location like /usr/local/bin/ that way binaries are accessible to everyone and automatically on PATH as well, so your 2nd requirement is satisfied.

  • This is ok for users that have the rights to install there.
    – Karl
    Jan 15 '13 at 12:44
  • @Karl and i take it oldGuy does not? Is newGuy able to see oldGuy's home dir?
    – Karthik T
    Jan 15 '13 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.