LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-10-2009, 05:31 PM   #1
Nix Bood
LQ Newbie
 
Registered: Jun 2009
Posts: 2

Rep: Reputation: 0
Questions about the filesystem hierarchy standard


Out of sheer curiosity, and perhaps boredom, I decided to play around with some linux distributions lately.

However, I quickly discovered something the confuses me greatly, that files for a program are spread out all across the filesystem, and that actual programs are needed to keep track of all the files for the purposes of installing and uninstalling. In windows, if something goes wrong, I just zoom over to the directory the program was in, delete it and am done, typically. The thought of something going wrong with the program managers for linux is horrendous.

I started googling around, and have read things like : http://en.wikipedia.org/wiki/Filesys...archy_Standard

Which explain what goes where, but I cannot find any explanation as to why things are laid out the way they are.

In windows, I become annoyed when the occasional program tries to use registry magic and shit all over my hard drive, but I am completely baffled at how linux seems to encourage it.

On windows I can simply brush off some of the sillier things as bad planning + the need to be backwards compatible, but in linux it seems to be very deliberate, so can someone please explain to me the reason for things being the way they are?

Am I overlooking something here? I'd like to tinker around with linux some more, but this is quite a stumbling block.
 
Old 06-10-2009, 06:29 PM   #2
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
Is there anything in the foreword of the TLDP article?
 
Old 06-10-2009, 07:34 PM   #3
Nix Bood
LQ Newbie
 
Registered: Jun 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Actually, I had come across that, and did skim through that forward, but it only really addresses some of the more technical things (most of which are frankly above my head, or at least my casual need for understanding), rather than why things are laid out in that peculiar way.

Perhaps I can clarify

Lets look at a nice program like 7zip.
http://img37.imageshack.us/img37/7633/windows7zip.png

All the files 7zip needs are all located within a single folder. If anything ever goes wrong with a new installation or uninstaller, I can simply find the folder, and delete it, and remove the reference. Done. I don't have to worry about naming conflicts, or files becoming orphaned. The only time there is a problem with anything, is when someone gets really "creative" with a program, and doesn't install the files in a easy to see common sense manner.

Correct me if I am wrong (which is entirely possible, I am very much a newbie here), but from what I can understand about linux, is that it wants me to take all those files, split them up, and put them in other folders with other files that have nothing to do with them.

Why?

As best I can tell, linux is quite deliberately making a mess of things.

Last edited by Nix Bood; 06-10-2009 at 07:37 PM. Reason: spelling error
 
Old 06-10-2009, 08:47 PM   #4
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware 14.2
Posts: 2,815
Blog Entries: 1

Rep: Reputation: 261Reputation: 261Reputation: 261
First of all, Linux ain't Windows (thank goodness). Don't try to understand Linux in the context of what you know about Windows.

Have you looked at the actual standard itself? It explains the purpose of the various hierarchies pretty well. Fundamentally, it boils down to two things. First, it is the *traditional* Unix layout. Second, the traditional Unix layout supports the basic security features found in Unix filesystems (but not Windows). Linux is quite deliberately making things secure.

You can take a look at Gobolinux for an alternative, more Windows-like, layout.
 
Old 06-10-2009, 09:12 PM   #5
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 70
See, it seems elegant and simple to me; I know that if I want/need to change a config file, its going to be in a specific place. I know that programmes will be in a specific place dependant on their use. Its like a lower down version of (God I hate myself for such a simplistic analogy) the Windows Start Menu. Everything is in a specific place. Programmes you would see as an accessory are in accessories, whilst games are in games.

The Standard puts things the same way, config files go in one place, critical programmes in one place, optionals in one place. Splitting them does two things, puts them in standard places, and also seperates should you decide to partition a disk to have a disk per root branch.

As weibullguy said, linux is deliberate about how it sets things out in a security context; imagine having all programmes and files in one place (a la Windows) and then finding either some malicious user/attacker or accident has damaged this one place. In such a situation, as us in the business would tell you, you're flumped.
 
Old 06-15-2009, 12:16 PM   #6
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 281Reputation: 281Reputation: 281
I also think a lot of the design decisions for the traditional unix hierarchy have been lost through the ages. But I imagine it started out with "hello, world", which had two parts, source code and a binary file after being compiled. After things got more complex, it was like, "oh, we also now have documentation we should stick somewhere". Then "Oh, wouldn't it be nice if we split out some configuration so you didn't have to recompile every single time you change a message print to stdout". Then "Oh, program foo can share this same compile time library with program bar, maybe we should put shared libraries somewhere else so they're easy to find", etc, etc.

So I'm sure it developed in a perfectly sensible way at the time, even if it doesn't seem that way to you now. But there's no denying that it ended up being very useful for security, even if it is a bit harder to weed out pieces without using your package manager. But I still would rather have orphaned files than have to mess with the windows registry. Needing a registry entry for every user on a machine and the general machine drives me crazy...
 
Old 06-15-2009, 01:00 PM   #7
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
Quote:
Originally Posted by Nix Bood View Post
In windows, if something goes wrong, I just zoom over to the directory the program was in, delete it and am done, typically. The thought of something going wrong with the program managers for Linux is horrendous.
that was true in the DOS windows 3.x days, but has not been true since windows 95.

Windows apps put files and application information in many locations throughout your system leaving much of it behind even when uninstalled using add/remove programs

Code:
The program directory, 
c:\program files\<application Name>

Registry keys in the registry

Shared files in
 c:\Windows\System32

User files \ profiles application data 
c:\documents and settings\username\application data\<somefolder>
c:\documents and settings\username\local settings\application data\<some folder>
Deleting the folder for the application from program files will remove the bulk of the application but leaves behind shared files in the System 32 directory not to mention how windows apps load the registry with entries that even when un-installed properly those keys are left behind,

Just don't want you to be confused and think that Microsoft manages application files with some simplistic method of everything in one folder.. it doesn't.

Last edited by farslayer; 06-15-2009 at 01:01 PM.
 
Old 08-27-2009, 04:20 AM   #8
mdixon
LQ Newbie
 
Registered: Oct 2003
Location: Perth, Western Australia
Distribution: Fedora & FreeBSD
Posts: 17

Rep: Reputation: 3
Question Where does User Application Data belong?

Where in the Linux Filesystem Hierarchy should one store user application data, such as the files for a financial accounting system. I understand that database files that belong to a database engine, such as for mySQL, will be automatically stored in the right place (such as /var/lib/mysql), but I was thinking of flat files.

Potential candidates I can see are /usr /var or /srv If so, would application files go into one of the classic subdirectories such as /usr/share or /var/lib ?


Another vaguely related question: is /pub part of the standard hierarchy? I did not see it mentioned in the documentation but it seems to be a very common directory in ftp sites that I visit. It does not get created at install time with any of the distros I have used.
 
Old 08-27-2009, 05:48 AM   #9
mushroomboy
Member
 
Registered: Jan 2006
Distribution: Debian Testing ALWAYS!!!
Posts: 363

Rep: Reputation: 43
Pub just means public =P Usually associated with anonymous users or... well lets just stick with anonymous users. IMO the linux hierarchy isn't so bad once you get used to it, well it seems to have grown on me. I like where things are stored, you get used to the locations...like if you wanted to modify a program you will know what files are where and what they do by the location, and I think that's good. Instead of having a muck of files in one place and not exactly knowing what controls what. Granted windows made file types, though sometimes the files aren't in the bulk folders...in linux they are always where they should be, or they wouldn't work. haha
 
Old 08-27-2009, 05:57 AM   #10
mdixon
LQ Newbie
 
Registered: Oct 2003
Location: Perth, Western Australia
Distribution: Fedora & FreeBSD
Posts: 17

Rep: Reputation: 3
Thumbs up

Thanks for the scoop on /pub[lic] MushroomBoy.

Any hints on the other question: Where in the Linux Filesystem Hierarchy should one store user application data, such as the files for a financial accounting system. I understand that database files that belong to a database engine, such as for mySQL, will be automatically stored in the right place (such as /var/lib/mysql), but I was thinking of flat files.

Potential candidates I can see are /usr /var or /srv If so, would application files go into one of the classic subdirectories such as /usr/share or /var/lib ?
 
Old 08-27-2009, 07:04 AM   #11
merer
LQ Newbie
 
Registered: Jul 2007
Location: Vilnius,Lithuania
Distribution: Slackware 12.2
Posts: 20

Rep: Reputation: 1
User application data should be stored somewhere in user's home directory (/home/username). All user specific data should go there. Unless I misunderstand your question - then please clarify what do you mean by "financial accounting system". I take that it's an application like gnuCash or kMyMoney2.
 
Old 08-27-2009, 07:08 AM   #12
mushroomboy
Member
 
Registered: Jan 2006
Distribution: Debian Testing ALWAYS!!!
Posts: 363

Rep: Reputation: 43
User data is stored in the users home (for user specific variables) or it's stored in the /usr directory if I'm not mistaken.
 
Old 08-27-2009, 06:50 PM   #13
mdixon
LQ Newbie
 
Registered: Oct 2003
Location: Perth, Western Australia
Distribution: Fedora & FreeBSD
Posts: 17

Rep: Reputation: 3
Post

Quote:
Originally Posted by merer View Post
User application data should be stored somewhere in user's home directory (/home/username). All user specific data should go there. Unless I misunderstand your question - then please clarify what do you mean by "financial accounting system". I take that it's an application like gnuCash or kMyMoney2.
I was thinking of a useland application, rather than system software, for a system used by several people in an organisation - say the whole accounts receivable department. Puting stuff in /home/... would mean granting access rights to other usernames. But using a system directory, might not be ideal either. Perhaps /usr is the place. I thought there might be a standard, or perhaps part of the Filesystem Hierarchy Standard for this sort of use?
 
Old 08-27-2009, 07:03 PM   #14
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Well, ther's a few options for user data:

1. create a separate user like MySQL or Oracle would, and all the data files belong under there. Possibly also the binaries, but in separate subdirs, ditto config. Similar to Linux, but ultimately under one top dir.
2. use the /usr/local area
3. /opt is popular also

There's summary diagram here http://4.bp.blogspot.com/_Vbsj-yhipT..._structure.jpg
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Filesystem questions zooper Linux - Server 2 07-14-2008 02:49 AM
LXer: Devices, Linux Filesystems, and the Filesystem Hierarchy LXer Syndicated Linux News 0 01-03-2006 10:31 PM
Desktop hierarchy filesystem: I WANT TO CHANGE IT!! opioid Linux - Software 2 03-28-2004 01:32 AM
Filesystem questions twinkers Mandriva 2 09-13-2003 07:36 PM
Filesystem Hierarchy Question - You probably get these alot. Sorry :( JoeLinux Linux - Newbie 4 04-23-2002 09:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration