1

I've recently switched from using windows and I'll now be running linux on my computer. In windows there's the program files folder. Most of a programs files go into its own folder there which to me seems easier to manage and browse around.

Program files in linux are stored in different places, what's the reasoning for doing this? Is it easier for developers to develop this way?

1

Yes.

In doing so, its ordered, like

  • Configuration files of all programs go under one path /etc
  • Binaries of all programs are under one path /bin, /usr/bin ...

There are other things like this, like /home , /dev /boot, /tmp etc..

  • Must this be adhered to when developing or is it just good practice? – Larry Lawless Sep 6 '15 at 9:23
  • It looks like google chrome is not in /usr/bin but in /opt/google/chrome why do you think they did not put there files in usr bin? – Larry Lawless Sep 6 '15 at 9:25
  • its a good practice. All distribution packages follow the convention. For third party packages like google chrome, its upto the developer whether or not to follow it. – Bharat G Sep 6 '15 at 9:29
  • I guess I should read up on programming under linux. I just think it seems a lot easier to think about programs in a single folder, more like its own module I dunno it might just be because I'm new – Larry Lawless Sep 6 '15 at 9:36
  • 2
    @LarryLawless: You may find this answer helpful. One disadvantage of the Windows scheme is that it makes it much harder for programs to share resources (libraries & device drivers, fonts, internationalization info, etc), so you end up with multiple copies of resources that could be shared. OTOH, not sharing resources can make it easier to avoid problems due to incompatibility, aka dependency hell. – PM 2Ring Sep 6 '15 at 10:54
1

Congratulations on your endeavor into Linux! In Ubuntu it is mostly as such:

programs or scripts /usr/bin
libraries for those programs /usr/lib
programs you have compiled and installed /usr/local/bin and /usr/local/lib
configuration for system programs /etc
per user configuration $HOME/.config

$HOME is an environment variable containing your home folder, eg. "/home/larry"

You will find many other programs putting user configuration files directly in $HOME, which is not best practice.

Some larger programs like to install in /opt because it keeps things tidy.

If the installation program gives me the option, and I don't need the program to be available to other users, I will install to $HOME/bin or $HOME/opt

Oh, and one final note: Windows installs files in several locations including c:\Windows\Program Files, c:\Windows\Program Files\Common Files, c:\Windows\System32 and c:\Windows\ProgramData, as well as config files in the users home directory. But worse, is the massive amounts of configuration information scattered all over the registry making program portability nearly impossible.

  • Thank you! Oh yeah, I'm already getting a better feel for how the fs works in linux than windows! – Larry Lawless Sep 6 '15 at 14:56
1

The Filesystem Hierarchy Standard might be worth looking through. Otherwise, disk space in the elder days was precious (and expensive!), so one might have a minimal / directory with programs and configuration necessary to boot and use the system, and then /usr and most other directories being mounted from a shared NFS server. Also, the variety of duplicated directories allows for a clean(er) separation of "vendor provided stuff" (e.g. /usr) and (at least typically on BSD) /usr/local for where packages get installed. This way, vendor updates should never trample anything the site has installed, as completely different directories are used. For example, the vendor might ship Webserver 2.0, but you need Webserver 1.1 for some application; if you installed Webserver 1.1 into the vendor space, vendor updates might then trample that, or other complications would be involved to not have the vendor replace that software...

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.