Ubuntu – The difference between /usr/locale and /usr/local

directoryfilesystem

After entering into root mode in /usr, I found the following directories.

swapnil@swapnil-Inspiron-3541:~$ sudo su
[sudo] password for swapnil:
root@swapnil-Inspiron-3541:/home/swapnil# cd /usr
root@swapnil-Inspiron-3541:/usr# ls
bin  games  include  lib  local  locale  sbin  share  src

I know the difference between bin and sbin but need help with local and locale.

Best Answer

In distributions like Ubuntu, /usr is where packages are supposed to install stuff and /usr/local is where the system administrator can install stuff outside the packaging system. From the Filesystem Hierarchy Standard:

The /usr/local hierarchy is for use by the system administrator when installing software locally. It needs to be safe from being overwritten when the system software is updated. It may be used for programs and data that are shareable amongst a group of hosts, but not found in /usr.

Locally installed software must be placed within /usr/local rather than /usr unless it is being installed to replace or upgrade software in /usr.

/usr/locale seems to be a mistake in packaging. It contains translations of text used by some Unity lenses, but those are supposed to go in /usr/share. For example, here's the directory structure of /usr/locale:

~ find /usr/locale
/usr/locale
/usr/locale/da
/usr/locale/da/LC_MESSAGES
/usr/locale/da/LC_MESSAGES/unity-lens-files.mo
/usr/locale/da/LC_MESSAGES/unity-lens-applications.mo

And in /usr/share/locale, one will find hundreds of such files:

$ find /usr/share/locale | head
/usr/share/locale
/usr/share/locale/tig
/usr/share/locale/tig/LC_MESSAGES
/usr/share/locale/tig/LC_MESSAGES/iso_639_3.mo
/usr/share/locale/tig/LC_MESSAGES/iso_3166.mo
/usr/share/locale/tig/LC_MESSAGES/iso_639.mo
/usr/share/locale/hsb
/usr/share/locale/hsb/kf5_entry.desktop
/usr/share/locale/hsb/LC_MESSAGES
/usr/share/locale/hsb/LC_MESSAGES/kjobwidgets5_qt.qm

Packages are not supposed to create more directories in the top level of /usr. This seems to be a harmless bug. You may report it if you feel like it.