I'm trying to get a program to work that isn't in my distro's package manager. It doesn't provide a makefile or sources, just binaries. If I copy the whole folder to /usr/local and then add that to my PATH in .bashrc, I can execute the program but there are problems. The program requires some local files from its directory, and they are stored as a relative path. The program looks for the files in the directory I'm currently in, not the directory that the program itself is in. Is there any way around this? Thanks.

2 Answers 2


If the program is really so unfriendly as to expect you to run it only from it's own directory then you may have to leave it in it's own directory (including sub folders) and create a script which is on your PATH. This script will change directories to the location of the program and run it. All will be well. Well... well enough. Something like:

#! /bin/sh -
cd /usr/local/crudesoftware &&

Many programs use environment variables that are unique to themselves.  For example, a program called foo might look for an environment variable called FOO_DIR or FOO_DATA_PATH (and it might use the current directory as a default if the variable isn’t set).  I know you said that you don’t have source, but do you have any documentation?  Maybe a sample .bashrc for using the program?

As a last resort, try

strings foo

(assuming that foo is the name of the program).  This lists all the “strings” in the binary file (see strings(1) for details).  This will produce a lot of output; much of it gibberish.  You should probably pipe it into a pager; e.g., more or less.  Look for lines that look like environment variable names –– i.e., all caps, possibly including underscores –– and try setting them to the directory where you installed the program.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .