I have a unix executable file located in a directory I generated. I believe I need to get this directory in my $PATH so that the unix executable is executable, but the documentation for the source code says that I need to edit my shell configuration file to add $home/meme/bin to my shell's path.

1 Answer 1


If you want to be able to execute a program by typing its name on the command line, the program executable must be in one of the directories listed in the PATH environment variable. You can see the current value of the variable like this ($ is your prompt, and the value below is an example):

$ echo $PATH

You have several choices; while #1 and #2 involve less advanced concepts, I recommend #3 which is less work in practice:

  • You can put the executable in a directory that's already on your PATH. For example, if /home/drbunsen/bin is already on your PATH, you can put the executable there. Or you can put the executable in /usr/local/bin if you want it to be available for all users.
  • You can add the directory where the executable is in your PATH. Edit the file ~/.profile (~/ means that the file is in your home directory) (create the file if it doesn't exist). Add a line like this:


    (Note that it's $HOME, not $home; unix is generally case-sensitive. You can also write ~/meme/bin, ~ is a synonym for $HOME when it's at the beginning of a file path.) The change will take effect the next time you log in. You can type this same line in a terminal, and it will affect the shell running in that terminal and any program launched from it.

  • The approach I recommend is to keep the executable with the other files that are part of the program, in a directory of its own, but not to change PATH either.
    Keeping the executable in $HOME/meme has the advantage that if you ever want to remove or upgrade the program, everything is in one place. Some programs even require this in order to find the files they use. Not changing PATH has the advantage that installing and uninstalling programs is less work.
    To get the best of both worlds, create a symbolic link in a directory on your PATH, pointing to the actual executable. From the command line, run a command like this:

    cd ~/bin
    ln -s ../meme/bin/* .

    That's assuming that ~/bin is already on your PATH; if it's not, add it through ~/.profile as indicated above. Pick another location if you like. Now making programs available is a matter of creating the symbolic links; making them unavailable is a matter of removing the symbolic links; and you can easily track what programs you've installed manually and where they live by looking at the symbolic links.

  • Gilles, wow thank you SO MUCH for the detailed explanation. I really appreciate your help. Thanks for taking the time to answer my question in detail and at a level that made everything crystal clear.
    – dr.bunsen
    Jul 7, 2011 at 22:41
  • Another thing that I noticed is that in the home/meme/ directory there doesn't appear to be a /bin directory. Do I need to create bin so that I can make a symbolic link in here to my PATH? Thanks.
    – dr.bunsen
    Jul 7, 2011 at 22:49
  • @dr.bunsen ~/bin is a common location, and some distributions create it automatically. If yours doesn't, you'll have to create it and add it to PATH manually. The location ~/bin is just a convention, you can pick another name if you like. Jul 7, 2011 at 22:56
  • The wildcard command does not work because ln interprets the last item in the expansion as a directory: "Usage: ln [OPTION]... [-T] TARGET LINK_NAME (1st form) or: ln [OPTION]... TARGET (2nd form) or: ln [OPTION]... TARGET... DIRECTORY (3rd form) or: ln [OPTION]... -t DIRECTORY TARGET... (4th form) " To solve this, I added "-t ./"
    – adam.r
    May 25, 2014 at 22:18
  • 1
    @adam.r I wrote ln -s ../meme/bin/* ., not ln -s ../meme/bin/*. Looks like you missed one character when copying the command. May 25, 2014 at 22:19

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.