Linux – the conventional install location for applications in Linux

default settingslinuxnetbeans

I'm currently installing NetBeans, and the default install directory is /home/thomasowens/netbeans-6.8. I'm not a fan of that location, so I'm looking at /etc, /bin, /usr/bin, and /sbin. Does Linux have a place that, by convention, is the same as Windows' C:\Program Files directory?

Best Answer

According to the Filesystem Hierarchy Standard, there are several places that are acceptable, depending on the application. I'm quoting from it extensively here.

  • bin is short for "binary" of course
  • sbin is short for "server binary", otherwise defined as:

    Utilities used for system administration (and other root-only commands)

  • /usr is for shareable, read-only data, and should be shareable between various FHS-compliant hosts (if you have lots of machines on your network, and they're all the same architecture, you should be able to share a single /usr folder with every machine on the network)

  • /usr/local is for use by the system administrator when installing software locally (ie, for applications installed only on this machine, not on every machine on the network).

Taking these together:

  • /usr/bin is the primary directory of executable commands on the system.
  • /usr/sbin is for any non-essential binaries used exclusively by the system administrator.
  • System administration programs that are required for system repair, system recovery, mounting /usr, or other essential functions must be placed in /sbin instead (ie, the things you need to access in order to mount /usr/sbin go in /sbin)
  • Likewise, essential user commands that may be needed before /usr is mounted go in /bin
  • Anything installed only on the local machine should go in /usr/local/bin or /usr/local/sbin

There's one other use for /usr/local though. Most things that you install through your distro's package manager will be placed under /usr; many people put things they've compiled by hand under /usr/local instead. This keeps them out of the way of the package management system and lets you spot what you installed from the distro (and don't need to back up because you can grab it again) and what you compiled by hand; it also lets you run different versions at the same time (eg, /usr/bin/firefox vs /usr/local/bin/firefox).


Just when you thought things were settled, there's one other place, which is probably the closest equivalent of c:\Program Files - /opt:

/opt is reserved for the installation of add-on application software packages.`

/opt is probably the closest equivalent to c:\program files, in that it's the one place you'd expect to find an application with all its files together in one folder, rather than scattered across /usr/bin, /var, and /etc. It's usually only used by very large packages, but in this case, given that Netbeans wants to have its own folder, it probably makes the most sense to put it under /opt/netbeans

Related Question