LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Difference between /usr and /usr/local (https://www.linuxquestions.org/questions/linux-newbie-8/difference-between-usr-and-usr-local-570052/)

jpostma 07-17-2007 06:41 AM

Difference between /usr and /usr/local
 
What is the difference between /usr and /usr/local?

Johannes

pixellany 07-17-2007 07:09 AM

Quote:

Originally Posted by jpostma
What is the difference between /usr and /usr/local?

Johannes

What is the context of this question?

The /usr directory is generally for applications and related data of interest to the users--as opposed to maybe the system administrator. /usr/local is a subdirectory within that--on my system, it does not have much in it.

Much of the filesystem setup traces back to Unix and, for most users, has no practical meaning. Nonetheless, the conventions get followed to make life easier for system admins, developers, etc.

Go to tldp.org and look for the "Filesystem Hierarchy Standard"

jschiwal 07-17-2007 08:05 AM

The /usr directory contains its own hierarchy which is similar to the root hierarchy. The /bin and /sbin directories will contain the basic commands needed to boot, run and administer the machine. When you add a package, it usually will install under the /usr hierarchy. Suppose that you want to compile your own software. It isn't something that is provided by the distro, and you would like to protect it from being altered during an upgrade or reinstall. The /usr/local hierarchy won't be touched by the distro.

Many tarballed packages will use /usr however. Often /usr/local/bin isn't added to the PATH.

In a heterogeneous network, where each host runs the same Linux distro, you might have have /bin, /sbin/, /lib, /usr, /opt and other directories mounted read-only. Instead of a local partition, an NFS share is mounted. In such an environment, the /usr/local directory may have a local partition mounted to allow you to install software with the base directory of /usr/local.

If you take any source package using autoconf, and run ./configure --help, you will see this option:
Code:

Installation directories:
  --prefix=PREFIX        install architecture-independent files in PREFIX
                          [/usr/local]

"./configure --prefix" will create a Makefile that will install the binary in /usr/local/bin, the libraries in /usr/local/lib, the manpage in /usr/local/man, etc.


All times are GMT -5. The time now is 08:55 PM.