It's not entirely clear to me whether it would be better to install a GUI application in /usr/bin
or my home directory. I've read through this article and this one, but it doesn't really talk about philosophy of how to use these different directories. Should commands should be treated differently from GUI applications?
5 Answers
The /usr/bin
is the primary directory of executable commands on the system.
The /usr/local
:
- Used 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.
More here.
There is no particular reason to make a difference between GUI and CLI commands.
/usr/bin
belongs to the operating system so, even while nothing prevents you, as root, to do it, you shouldn't put anything here. This directory is for people distributing software integrated with the OS and properly handling/avoiding name conflicts.
/usr/local/bin
is a common directory for locally built software. If you can write here, you can just use this directory.
/opt/<name>/bin
is for software not belonging to the OS. It is a good location for shared software.
Your home directory belongs to you so you are free to put anything you like anywhere under it but it is not the best location if other people need to run your program.
-
1So is the only difference between /usr/local/bin and /opt/foo/bin where/how the software was installed? So as a rule, any software I manually install should go in the the former and anything installed from a package manager will end up in the later? EDIT: It appears so. link Dec 31, 2012 at 21:45
-
Yes. Note that locally built software might also go to /opt/local/bin. This avoid an issue with /usr/local that much be writable while /usr might be mounted read-only.– jlliagreJan 1, 2013 at 9:02
Do not install anything manually in /usr/bin
. The whole of /usr
, as well as /bin
, /lib
and /sbin
, are reserved for software provided by your distribution. There is an exception: /usr/local
, which is intended for programs installed by the system administrator and is not touched by package managers (except for creating a few directories). (That's on Linux, other unix variants may have package managers that install software under /usr/local
.)
Between /usr/local
and a place in your home directory, the choice is yours. If you want a program to be available to all users, put it in /usr/local
. If you want it to be available only for you, install it in your home directory.
Whether the program has a GUI or not is irrelevant.
-
1
/opt
is also sometimes used for local installations, though the division between/usr/local
and/opt
is not clear. Jan 21, 2015 at 8:29
If it makes sense (or is required) for the user to be able replace the binaries of the application then it must be installed in the user's home directory. Otherwise it can be installed in a public, read-only directory such as /usr/bin
.
For global use you can install it to /usr/bin but nobody recommends that.
For using some application as a specific user (it should be more secure, when running it as 1 user) install it to home directory of specific user.