0

From the amateur knowledge that I have, I know that /bin is where all the system needed packages are present which can be used to debug and work if the system faces any problems, in short packages needed bare minimum for the system.

  1. Can while installing a package for ex: on Ubuntu can I direct where to install the package, as in which directory I want it to go?
  2. Also, what kind of packages would on installation end up in /bin?
  • 1
    Packages install executable commands to /bin. They don't go wholesale into that directory. – muru Feb 3 '17 at 1:33
  • If you're installing a new shell like zsh, ksh, or tcsh, those end up in /bin/<name_of_shell> on Debian... – Gregory Nisbet Feb 3 '17 at 1:40
  • 1
    Correction: /bin is where executables files are placed, not whole packages. A packages typically consists of lots of files, some go into /bin, some go into other directories. So, phrased as it, the question makes no sense. And no, you can't decide where to install files while installing packages. – dirkt Feb 3 '17 at 9:21
2

In general, it is the maintainer (not the user) that decides which directory a package installs to. A given Linux distribution usually has a policy as to what should go where.

Many distributions (including Ubuntu) place user-installed packages into /usr, so the executable binaries would be in /usr/bin. By contrast, /usr/bin and /bin are the same place in Arch Linux, so almost every package installs its executable to /bin.

In distributions that do keep /bin separate, it is usually reserved for some kind of minimal base system, including: a shell; tools to check, mount and unmount filesystems; and anything else the system deems essential.

  • Ubuntu makes no distinction between “user-installed” packages and packages installed by default. (There are different default installations anyway.) All packages include files under /usr (at least documentation under /usr/share/doc. Files in /bin, /lib and /sbin are roughly speaking the ones that are necessary to get the base system fully booted, in particular what may be needed to mount /usr. – Gilles Feb 3 '17 at 21:47
0

Ubuntu packages are not relocatable. Their files goes wherever the package says they go. The same goes for most distributions.

When you have a packaging system, there's not much point in having relocatable packages. The package manager keeps track of where the files of each package are located, so they don't need to be grouped in any particular way. The system administrator doesn't need control over where each package goes: there's a location for files managed by the package manager, and the administrator does not manipulate those files directly, only through the package manager.

On Linux, the norm is to put programs managed by the package manager under /usr (omitting /usr/local), /bin, /lib and /sbin (plus a few more, I won't go into details). Programs installed by the system administrator without using the package manager go under /usr/local or /opt. (Some distributions also put things under /opt, but not Ubuntu.)

The distinction between /bin and siblings and their counterparts under /usr is that the things that are needed to get the system operational all need to be outside of /usr. This distinction dates back from times when it was relatively common to make /usr a separate partition: anything needed to get that partition mounted, or needed for the system administrator to log in and repair stuff, had to be outside of /usr, directly on the root filesystem. These days, disks have gotten large enough that a network-mounted /usr no longer makes sense in most setups, and filesystems have progressed so that mounting /usr read-only no longer gives an advantage. So the distinction between /usr and /bin-and-siblings is moot; some distributions (such as Ubuntu) preserve it, others don't (and make /bin a symbolic link to /usr/bin or vice versa).

The split between the root filesystem and /usr is by file, not by package. Every Ubuntu package includes at least a couple of documentation files that go under /usr/share/doc. Most packages that put files in /bin also put files under /usr, e.g. executables that are less critical, man pages, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.