Ubuntu follows the filesystem hierarchy structure. The location where software gets installed depends on how you install it. According to the FHS, /usr
hierarchy is reserved for the software provided by the Linux distribution. By convention, /usr/local
is reserved for software compiled and installed manually. The /usr/local
directory should contain a structure very similar to that of the /usr
directory. The /usr/local
directory provides a location for software installation that overrides versions of the same packages installed in the /usr
directory structure, because system software updates often overwrite software in /usr
without prejudice.
Default Installation
Software installed using Ubuntu Software Center generally gets installed to the default locations. Libraries will end up in /usr/lib/
and the executable in /bin
(essential command binaries available in single user mode; e.g., cat, ls, cp), /usr/bin
or /usr/sbin
(non-essential command binaries).
Linux distribution packages get installed in
/usr
directory tree. For instance, if you installed the Autoconf package using the command sudo apt-get install autoconf
, the package binaries would be installed into the /usr/bin
directory. When you install your hand-built Autoconf binaries, they’ll go into /usr/local/bin
, by default.
The direct equivalent of Program Files
though is probably /opt
or maybe /usr/share
. That directory contains the various support files for most programs.
Manual Installation
If you are compiling your own software then you ultimately control the installation location. By convention, software compiled and installed manually (not through a package manager) is installed in /usr/local
. Some packages will install their files into existing directories such as /usr/local/sbin
and /usr/local/
etc. These are simply default locations and can be changed during compilation. Your source code should not be stored in /usr/src
as that is designated for system software such as the kernel.
Finally, you need to ensure that your installation location is included in your PATH. If you decide to install your package in /opt
but it’s not in your PATH your shell won’t find the executable. It’s most often the case that /usr/local/bin
is positioned in your PATH environment variable before /usr/bin
. This allows your locally built and installed programs to override the ones installed by your distribution’s package manager.
Locate Application
To know where the executable is you can run whereis
or which
or type
. For instance, below example find the installation of directory of bash.
If the installed program is in PATH, above command returns the path as shown above. If the installed application it is not in PATH, then it’s best to look for it with
locate
command. For example to find anything named git present in bin
folder, use below command
locate -b git | fgrep -w bin