1

It seems to me that there's a lot of confusion (or at least there is on my part) about how different file systems are structured among different distributions of Linux/Unix.

It would stand to reason then that instead of having different types of packages for each system, it would be more useful to have environment variables that point to the different directories in individual file system structures.

For example: If I wanted to know the location of the "program files" directory on a windows system, I could use the environment variable %ProgramFiles% or %ProgramFiles(x86)%. Is there any such facility on Linux or Unix systems?

Mat
  • 52,586
  • 2
    If we can't agree on a file-system hierarchy, then what makes you think we can decide on a set of environment variables and names? :D – gardenhead Jan 01 '16 at 04:56
  • oh yeah. windows has got that locked down for sure. nevermind the entire root-level tree named for programs built for some other architecture playing a central role. – mikeserv Jan 01 '16 at 05:05
  • I guess the biggest reason I was asking is that it seems to put a burden on developers to have to create or maintain all these different types of packages to encourage use of their software (not that it's required, but I'd personally more likely use a built package before I would install from source). Additionally I've seen a lot of questions (and often have those same questions) about what goes where on which distros. I've read and (mostly) understand the FHS but it seems like it's a complication that could/should be avoided relatively easily. Thanks for your input all. – apocalysque Jan 02 '16 at 07:24

3 Answers3

0

If I understand correctly, you mean the names and the paths of different programs should be the same across different distributions , such as Ubuntu , debian , and redhat/centos.

I would take the example of web server , Apache. Some distributions installs it by the name apache2 and names its configuration file as apache2.conf , while others installs it as httpd and names it configuration file as httpd.conf , and the paths to these files also differ across distributions.

One such project that achieves configuration management uniformity across different distributions is puppet (https://puppetlabs.com/) , the other is Chef , and many other out there.

These configuration management systems hide the differences in file system hierarchy or path names or different package names from system admin.

Ijaz Ahmad
  • 7,202
0

My formatting:

The Filesystem Hierarchy Standard (FHS) is a reference describing the conventions used for the layout of a UNIX system."

Since it's just a set of conventions, and Linux is not created by a single company, it's inevitable that various *nix developers will deviate from the standard based on practical concerns such as legacy code and preferences. Adding variables to the mix would only further complicate matters rather than simplify them, since distro creators would still be beholden to no-one, and since "variables" becomes a very fuzzy concept when things other than just the shell come into play.

l0b0
  • 51,350
0

Linux doesn't have an equivalent to Windows's %ProgramFiles% variable because it doesn't need one. There's a standard location for programs that are installed in their own directory: /opt. Bit most programs aren't installed there, because they come in packages, and their files are located where they will be found by other programs. The reasons why Windows has a %ProgramFiles% variable are in fact largely historical:

  • Windows has drive letters. Even if \Program Files was the standard location, there'd still be the question of whether it's c:\Program Files, D:\Program Files, etc. Linux has never had this issue because symbolic links allow a directory to appear anywhere, regardless of which physical storage medium it's on. (Modern Windows don't need this because they have an equivalent feature, but the location remains modifiable for backward compatibility.)
  • Windows lets the administrator choose the name of system directories. Linux doesn't; that's ok because it never did, whereas Windows had to accommodate administrators who chose different locations for backward compatibility.
  • Every Windows program comes with its own installer, so there's no real package management mechanism, and the only way to keep track of what files belong to what package is to have one package per directory. That's beginning to change, but not quite there yet. In contrast, Linux usually stores files where they will be found and lets the package manager keep track of who they belong to.

Linux does have environment variables that specify paths: PATH for executable commands, LD_LIBRARY_PATH for shared libraries, MANPATH for manual pages, etc. They're all about where to find files, not where to put files. Where to put files isn't something that programs know, it's something that package managers know. Package managers have their data files, they don't need environment variables to tell them where things are.

The directory structure on Linux systems is standardized in the Filesystem Hierarchy Standard. There's no need for environment variables for most of these, either because the location is standard or because there's no need for a single location.

The fact that different distribution have different package systems isn't due to having different directory structures. It's one of the main differentiators between distributions.

  • Picked this one because it's the most complete answer. Essentially I think the mention of the FHS is the most helpful nugget in this and l0b0's answer. While it doesn't exactly tell you where things are going to be found on each distro, it does tell you where things should be found generally. – apocalysque Mar 31 '19 at 22:07