As uther mentioned, /usr/local
is intended as a prefix for, essentially, software installed by the system administrator, while /usr
should be used for software installed from the distribution's packages.
The idea behind this is to avoid clashes with distributed software (such as rpm
and deb
packages) and give the admin full reign over the "local" prefix.
This means that an admin can install custom compiled software while still using a distro like Debian.
Software placed in / or /usr may be overwritten by system upgrades (though we recommend that distributions do not overwrite data in /etc under these circumstances). For this reason, local software must not be placed outside of /usr/local without good reason.
When installing user-specific software, uther suggests using $HOME
as the prefix since this ensures you have write permissions. Personally, I feel using $HOME/.local
to be a more elegant solution, since it avoids cluttering your (hopefully) nice and tidy home directory!
$HOME/.local/share
and $HOME/.local/bin
are already used in the freedesktop.org XDG Base Directory specification, and distributions are requested to add $HOME/.local/bin
to the $PATH
, so it doesn't take much to envision making a $HOME/.local/lib
, etc, while you're at it.
If you don't really want your prefix to be a hidden directory, you could easily create a symbolic link to it as well, e.g:
ln -s .local ~/local
Sidenote
It is worth noting that .config
(not .local/etc
) is the default value for $XDG_CONFIG_HOME
used for user specific config files. I should also point out that, unfortunately, a large portion of software ignores the XDG and creates config files wherever they like (usually in the root of $HOME
). Also note that $XDG_CONFIG_HOME
may be unset if the default $HOME/.config
is desired.
Oddly, there is no directory reserved for a distribution's default config files, so there is no way to know if a file in /etc
was supplied by the distro or edited by the system administrator.
~/.local/bin
– This is the way. – Daniel Jan 07 '20 at 12:12