Linux directories Linux directories unix unix

Linux directories


The listing varies depending on the Linux filesystem.

1) /bin, /usr/bin, /usr/local/bin

2/3) /lib, /usr/lib, /usr/local/lib

3. /usr/share/lib

4) /etc is a read-only spot for configuration data.

5) /usr/local/etc or usually in the /home directory under the dot directory name, if the profile allows the bin directory to be located under the /home/user_id/bin where 'user_id' is the relevant login id.. for an example for user 'jdoe', his configuration could be written to /home/jdoe/.configs or ~/.configs

Do not rely on this, for the most part the LSB filesystem dictates that there shall be at minimum:/bin, /etc, /usr, /lib, /home

For instance, the /usr could be on a different partition, likewise the same for /home

Edit: Thanks to dtrosset for pointing out my blooper....


  1. $PREFIX/bin
  2. $PREFIX/lib
  3. $PREFIX/lib
  4. /etc
  5. $HOME/.config

Where $HOME is the home directory of the user running the application, determined at runtime. $PREFIX depends on the method of distribution:

  • If distributed as source, $PREFIX should be configurable but default to /usr/local;
  • If distributed as a binary tarball, $PREFIX should usually be /usr/local (but /opt is also common);
  • If distributed as a distribution package (eg RPM or DPKG), $PREFIX should be /usr.

Documentation and other architecture-independent files should go in $PREFIX/share/doc; program-generated files shared between instances should go in /var/run (things like lockfiles, pidfiles and sockets) or /var/lib (things like shared binary databases).