Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have an executable for the perforce version control client (p4). I can't place it in /opt/local because I don't have root privileges. Is there a standard location where it needs to be placed under $HOME?

Does the File System Hierarchy have a convention that says that local executables/binaries need to be placed in $HOME/bin?

I couldn't find such a convention mentioned on the Wikipedia article for the FHS.

Also, if there indeed is a convention, would I have to explicitly include the path to the $HOME/bin directory or whatever the location of the bin directory is?

share|improve this question

1 Answer 1

up vote 20 down vote accepted

In general, if a non-system installed and maintained binary needs to be accessible system-wide to multiple users, it should be placed by an administrator into /usr/local/bin. There is a complete hierarchy under /usr/local that is generally used for locally compiled and installed software packages.

If you are the only user of a binary, installing into $HOME/bin is the appropriate location since you can install it yourself and you will be the only consumer. If you compile a software package from source, it's also appropriate to create a partial or full local hierarchy in your $HOME directory. The full local hierarchy would look like this.

  • $HOME/bin Local binaries
  • $HOME/etc Host-specific system configuration for local binaries
  • $HOME/games Local game binaries
  • $HOME/include Local C header files
  • $HOME/lib Local libraries
  • $HOME/lib64 Local 64-bit libraries
  • $HOME/man Local online manuals
  • $HOME/sbin Local system binaries
  • $HOME/share Local architecture-independent hierarchy
  • $HOME/src Local source code

When running configure, you should define your local hierarchy for installation by specifying $HOME as the prefix for the installation defaults.

./configure --prefix=$HOME

Now when make && make install are run, the compiled binaries, packages, man pages, and libraries will be installed into your $HOME local hierarchy. If you have not manually created a $HOME local hierarchy, make install will create the directories needed by the software package.

Once installed in $HOME/bin, you can either add $HOME/bin to your $PATH or call the binary using the absolute $PATH. Some distributions will include $HOME/bin into your $PATH by default. You can test this by either echo $PATH and seeing if $HOME/bin is there, or put the binary in $HOME/bin and executing which binaryname. If it comes back with $HOME/bin/binaryname, then it is in your $PATH by default.

share|improve this answer
as long as $HOME is not on a noexec mounted filesystem. /tmp/ is usually mounted noexec too. –  ewanm89 Apr 19 '12 at 17:24
This is correct, its part of the Filesystem Hierarchy Standard (FHS). pathname.com/fhs/pub/fhs-2.3.html#USRLOCALLOCALHIERARCHY –  Patrick Apr 19 '12 at 22:58
I would not recommend using $HOME. This inundates your home directory with numerous directories that you are not interested in at all. Who wants to have man, lib, etc. in ones home dir? I would rather create the hierarchy below $HOME/bin or $HOME/local. That adds only one subdirectory to your home dir, instead of ten. The PATH can easily be adapted to include $HOME/bin/bin or $HOME/local/bin. –  Marco May 3 '12 at 0:43
Agreed, I wonder why anybody wants to pollute $HOME by 10 more directories (in addition to dozens dot-files). –  maaartinus Jun 5 '12 at 22:45
One option is to use $HOME/.local/{bin,lib,etc.}, as used by e.g. the XDG basedir spec (standards.freedesktop.org/basedir-spec/basedir-spec-latest.html ) and python (python.org/dev/peps/pep-0370 ) –  janneb May 28 '13 at 19:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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