When deploying my application under linux, where do I put my libraries, executable and the desktop entry file? And what about other files my program needs? For example background pictures, audio files etc.

I heard that I put my executable file in the /usr/bin/ folder, my libraries in the /opt/<myapp>/lib/ folder and my desktop entry file in /usr/share/applications/ folder. Is that correct?

But where is the general place for application resources?

Is that everything I need to care of when deploying my application or are there other steps I am missing?

  • The question is not precise. Are you building a binary package for installation into the system, or planning to do a local installation? I assume the former, which is consistent with most of your paths except the /opt one. The LHS says /opt should not be used for binary packages that are part of the system. Commented Feb 9, 2014 at 17:45
  • There are several Q's that are related to this topic on the site. The FHS is what often is referred to when determining where installed assets go: pathname.com/fhs.
    – slm
    Commented Feb 9, 2014 at 18:10
  • Somewhat related: unix.stackexchange.com/questions/74646/…. Also take a look at the man page: man hier.
    – slm
    Commented Feb 9, 2014 at 18:12

1 Answer 1


The Filesystem Hierarchy Standard specifies where to put files.

If you're installing files outside of the package manager, always put them under /usr/local or under /opt. Never touch anything under /usr except via the package manager, except for things under /usr/local.

  • /usr/local/bin: executables intended to be executed by users (interactively or from scripts)
  • /usr/local/lib: libraries available to many programs, not just yours
  • /usr/local/lib/YOUR-PROGRAM-NAME: any other architecture-dependent files
  • /usr/local/share/doc: documentation (except in man and info format)
  • /usr/local/share/info: documentation in info format
  • /usr/local/share/man/man*: man pages
  • /usr/local/share/YOUR-PROGRAM-NAME: any other architecture-independent files

These days, the separation of the share area which contains architecture-independent files isn't very important. It was devised back when hard disks were smaller and it was important to save space by not storing architecture-independent files twice in heterogeneous networks. You can skip this distinction if you like and put everything under lib/YOUR-PROGRAM-NAME.

If you prefer to use /opt, put everything under /opt/YOUR-PROGRAM-NAME, and make symbolic links in /usr/local/bin (and /usr/local/share/man/man* and /usr/local/share/info if you provide documentation in man and info format) so that users can invoke your program.

If you make deb or rpm packages, put files under /usr instead of /usr/local. Check each distribution's documentation for its particularities.

You must log in to answer this question.

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