Location of Linux programs

Hi, again. I am wanting to know where all of the Linux programs are installed. The OS I am asking about is Ubuntu 14.04 LTS. Can anybody tell me where these programs are located? Thanks in advance!
 

onichikun

Distinguished
Nov 13, 2009
304
1
18,860


The actual location of programs is really distribution dependent. The package manager will install libraries and executables into various locations, including:
/bin/ - system-wide non-superuser binaries
/sbin/ - system-wide superuser (root only) binaries
/lib/ - 32-bit libraries
/lib64/ - 64-bit libraries
/usr/bin - user binaries
/usr/lib - user 32-bit libraries
/usr/lib64 - user 64-bit libraries
/usr/sbin - some distros use this directory, but many modern distros have dropped it
More info: https://news.ycombinator.com/item?id=3519952

Some distros will also change their directory layouts, like ArchLinux did.

EDIT: forgot to mention /usr/share/bin and /opt/ (which is used for non-package-managed binaries)
 
You also forgot to mention /usr/local/bin, /usr/local/sbin, and /usr/local/lib which many distros will install non-standard programs to. A good rule of thumb is to look at what directories are specified in the PATH environment variable.

Any particular reason for asking? There are easy ways to discover where a particular file is located.
 

onichikun

Distinguished
Nov 13, 2009
304
1
18,860


Good point :) I don't think I've used a distro that takes advantage of those locations for awhile!
 


No distro should ever take advantage of /usr/local. It should always be an empty directory after a fresh install (or a skeleton directory containing only other directories). /usr/local is considered to be a safe place for the system administrator to install software that will not be interfered with by the distribution. Installing additional distribution packages, upgrading packages, and upgrading the distribution itself should never affect the contents of this directory.

/usr/local is the default installation prefix for many (perhaps even most) upstream free software. For example, a distribution may ship with libSDL version 1.x installed in /usr/lib. If the user wishes to install libSDL version 2.x using the library's sources (rather than the distribution's sources if the distribution even has libSDL version 2.x) the administrator may install it to /usr/local/lib.

The same is more or less true with /opt, it's a location that should be left alone by the distribution's software maintenance programs.
 
That's too prescriptive, and in practice is not useful. The simple fact is that a Linux system may have programs installed to /usr/local/bin, and a BSD system certainly will have. It is a location you need to check.

As I said before, the easiest thing to do is to look at which directories are in your PATH variable.