Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Directory Structure Hierarchy
#1

Hello,

 

I'm not 'new' to Linux, per-se, but I am still learning (and have a lot more to go). One of the most boggling things I have encountered is the root directory structure. Could someone clarify to me what each folder/subfolder is used for? (Yes, I know that some of this is tedius work and I do know some... but still would like clarification/confirmation on what I know.)

 

I do know that the /home directory is for a user's home folder (aside from root), and I know the /mnt directory is the preferred mounting directory. Those two I do not need advice on, but the rest would be appreciated.

 

I'm running Fedora Core 4.

 

Thanks for your time,

Iyce

Reply
#2

Ok.. first.. I can understand your confusion.. UNIX based filesystems are wildly different from Windows.. so lets just get stuck in..

 

(for a FULL spec look on FHS)

 

I should also point out before I delve, this is a "standard" .. it doesn't always hold perfectly true there is programs that break it (notice I say programs, most distros attempt to solve the programs that break it).

 

/bin

This directory is for BINaries that are required to make the system boot. These programs are very important. You have the likes of shell (bash) and the mount command in here. Without this directory you will not boot!

 

/dev

This directory contain all the files that represent your devices. It is utterly required, without it your system would not work. In the early days this directory was full of millions of files, nowadays it is a "virtual" directory. That means that it doesn't take up filespace (like files do) but instead it is a representation of the devices the kernel can see. For a noob you probably wouldn't need to venture into this directory too much.

 

/etc

This is all the config files for the local system. What this means is that it hold all the configuration files for the programs installed on your machine. It is a dangerous directory to play around with as you can easily affect your system to the point that it will not start.

 

/etc/X11

As said, this is a configuration directory. I point it out as its the directory that contains the files to configuration Xorg/XFree.

 

/etc/skel

This is another interesting directory, when you create a new user, do you ever wonder where it gets its default files from? Well here is the answer, when you make a new user the files present in /etc/skel are copied into the newly made home directory.

 

/lib

This directory contains library files. These libraries are only for the binaries (read executables/programs) held within the /sbin and /bin directories. They are vital to the booting of your system.

 

/mnt

This is a directory used to mount various devices temporarily (like a floppy or a CD/DVD).

 

/opt

This is an unusual one. The idea behind it is more like that of Windows. Basically it installs all of what a program requires to run in one big directory (think "Program Files"). So for instance /opt/Real would be the entire programs/libraries/manual pages of Real Player. Normally this is used for software that is puchased (or free binaries only).

 

/proc

This is another "virtual" directory, it doesn't take up any room. The files in here are very special, they contain information that comes directly from the kernel. Equally you can tamper with them to feed information directly back into the kernel. Obviously this is quite a powerly directory and shouldn't be tampered with. Saying that you can see some nice info about your system:



Code:
cat /proc/version /proc/cpuinfo




 

/sbin

This is the "Superuser BINaries". The binaries (programs) inside this directory should only be for use by the superuser (root, think Administrator). These programs are normally vital for booting or for file system recovery/creation.

 

/usr

This is normally one of the largest areas on the system. This directory contains "USeR" binaries, libraries, manuals, etc, etc. Basically all the programs that aren't required to make the system "just work" are in here. You will find Xorg, KDE and Gnome in here. You will find pretty much all the programs that you would generally use day to day in here.

 

/usr/X11R6

This is the directory that still exists (but if the FHS has its way will soon be gone). It contains all the files from Xorg (sort of like opt does).

 

/usr/local

If you are ever going to install some personal programs. Maybe you are running an RPM based system (like Fedora) and want to install something from source. THIS is where you should put it. This directory is just like /usr in the fact that it contains programs that aren't vital for the system booting but are normally wanted for when the system is running. The big benefit of this area is that it is intended for the personal user to make "LOCAL" modifications.

 

So lets say you have a program called "Hello" installed from RPM but you know a newer version exists. You can install the package from source into this directory without screwing your RPM based system!

 

/var

This is for VARiable data. Basically most things that need somewhere to write information (like log files) write it into this directory. If you have a mail server running, it will write the mail into /var/mail. The logs would go in /var/log. If you are printing files then the temporary files that are passed to the printer will be stored in /var/spool. Again this directory is on the top level and therefore is required for booting.

 

/boot

Some systems will not have this "mounted". This directory is completely for boot and nothing else. It contains information that is required by the "boot loader" to start the system. You will normally find the kernel is stored in here.

 

/tmp

This is just as it sounds a TeMPorary directory. This is meant to store files that are only to remain on your system temporarily. It sometimes gets abused with "rootkits" but thats a whole story unto itself!

 

/sys

You might find this directory doesn't exist if you are using an older system. If you are using a new 2.6 kernel (with udev) then it will be there. This is yet another "virtual" directory. It contains HUGE amounts of information and in honesty you will probably never care about its contents, not unless you want to play with udev

 

 

 

Ok so .. I think I covered most of the important ones, just ask for more about these, or more about others and I'll provide an answer :)

Reply
#3

great reply to a good question,

 

thanks znx, this topic is pinned and moved to 'files, dirs, file systems, mounting'

 

cheers

anyweb

Reply
#4

o_O

Wow... good answer!

Reply
#5
danke :)
Reply
#6
Nice anwser znx
Reply
#7

Nice one, znx. There's one mistake though. :)

 

Quote:/usrThis is normally one of the largest areas on the system. This directory contains "USeR" binaries, libraries, manuals, etc, etc. [...]
Many people think that 'usr' is short for 'user' but that's not true. It's inherited from UNIX and is supposed to mean UNIX System Resources. :)

Reply
#8

Quote:Many people think that 'usr' is short for 'user' but that's not true. It's inherited from UNIX and is supposed to mean UNIX System Resources. :)
 

[img]<___base_url___>/uploads/emoticons/default_ohmy.png[/img] AWESOME.. this I defn didn't know!

 

Cheers z0ny ;)

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)