Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

What's the difference between the many libs in Linux system? (/lib, /usr/lib, /var/lib, /usr/share/lib, etc, etc).

I know it's handled automatically by synaptic whenever I install an application, but in case I want to be a Linux developer, I sure need to know where to put my application libs in the system.

share|improve this question
up vote 5 down vote accepted

Typically, your software will be installed either under /, or /usr, or /usr/local. This is called the "prefix". / is typically reserved for the most critical operating system programs. /usr/ is reserved for use by package managers. Therefore, when you write software, it is most polite to set it up so that the prefix will be /usr/local. Then this can be overridden when someone packages it for a distribution.

Notice I'm not specifically talking about "lib". There are several common subdirs under the prefix, lib being just one of them. "bin" is used for executables, "share" for data files, "lib" for shared libraries and so on. So if your program is a library, you can install it by default to /usr/local/lib. If it's a normal program, you can have it install to /usr/local/bin with your data files in /usr/local/share. The important thing is that you make it so the prefix is selectable at compile time. Some may prefer to install to /usr rather than /usr/local or vice-versa.

share|improve this answer
So your point is that the locations is rather a guideline than a hard limit? – andreas Nov 18 '09 at 3:52
It's a guideline, but it SHOULD be followed, and many applications expect certain files in certain places. – Jim Deville Nov 18 '09 at 6:35
@james point taken :D – andreas Nov 18 '09 at 8:40

There is also a standard that describes linux/unix filesystem hierarchy. It can be found at: This is meant mainly for distribution developers, but I don't see any reason who a user/developer should not be aware of it.

share|improve this answer
that was useful, thanks! – andreas Nov 18 '09 at 8:41

/bin and /sbin

  • binaries used for system administration and also in single usermode. Their library files are located in /lib.

/usr/bin and /usr/sbin

  • contain non essential non essential binaries used by all user and binaries used for network services and all.Their libraries are placed in /usr/lib.


  • contain files which preserve information about state of running programs or instances of programs .user neednt change this.


  • Contains architecture-independent data files.
share|improve this answer

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.