In Linux the different locations usually, when well maintained, mirror some logic. Eg.:
/bin contains the most basic tools (programs)
/sbin contains the most basic admin programs
Both of them contain the elementary commands used by booting and fundamental troubleshooting. And here you see the first difference. Some programs are not meant to be used by regular users.
Then take a look in
/usr/bin. Here you should find a bigger choice of commands (programs), usually more than 1000 of them. They are standard tools, but not as essential as those in
PATH variable pointing to the executables. It also introduces clarity. Whatever is should be executable.
Take a look at my
$ echo "$PATH" | perl -F: -anlE'$,="\n"; say @F'
There are exactly six locations containing the commands I can call directly (ie. not by their paths, but by their executables' names).
/home/tomas/bin is my private directory in my home folder for my private executables.
/usr/local/bin I'll explain separately below.
/usr/bin is described above.
/bin is also described above.
/usr/local/games is a combination of
/usr/local (to be explained below) and games
/usr/games are games. Not to be mixed with utility executables, they have their separate locations.
/usr/local/bin. This one is somewhat slippery, and was already explained here: What is /usr/local/bin?. To understand it, you need to know that the folder
/usr might be shared by many machines and mounted from a net location. The commands there are not needed at bootup, as noted before, unlike those in
/bin, so the location can be mounted in later stages of the bootup process. It can also be mounted in a read-only fashion.
/usr/local/bin, on the other hand, is for the locally installed programs, and needs to be writable. So while many network machines might share the general
/usr directory, each one of them will have their own
/usr/local mounted inside the common
Finally, take a look at the
PATH of my root user:
# echo "$PATH" | perl -F: -anlE'$,="\n"; say @F'
It contains these:
/usr/local/sbin, which contains the admin commands of the type
/usr/local/bin, which are the same ones the regular user can use. Again, their type can be described as
/usr/sbin are the non-essential administration utilities.
/usr/bin are the non-essential administration and regular user utilities.
/sbin are the essential admin tools.
/bin are the admin and regular user essential tools.