[lug] Newbie Column #5 - A quick tour of the root file system

Wayde Allen wallen at boulder.nist.gov
Thu Feb 3 15:46:13 MST 2000


OK, so hopefully you've logged on, and been able to make a directory
(mkdir), moved into the directory using the "cd" command, and perhaps
tried listing the contents of the directory with the "ls" command. If so,
it is time to take a tour of the file system to see where everything is. 
What I'm going to describe will be specific to my Debian box, but
should be the same basic idea on most UNIX based systems. 

For those of you familiar with DOS, you may remember that it was customary
to have a directory called DOS in which the system level DOS commands were
stored. Everyone had a DOS directory, and then created the rest of the
directory structure themselves. Here in the UNIX world, it is similar,
except there are many more people accessing the system at any given time,
and more than one person working to define the layout of directories. For
this reason, some standardization is needed to keep things from getting
too jumbled up. Let's take a look at a typical root directory, and
describe the purpose of the subdirectories.

First log onto your system. Then, using <return> to mean pressing the
carriage return or enter key, type:

   cd /    <return>
   ls      <return>  

This should take you to the root directory "/" and display it's contents.
You should see something like: 

   yourhost:/> ls
   bin          etc          lib          root         var
   boot         floppy       lost+found   sbin         vmlinuz
   cdrom        home         mnt          tmp          vmlinuz.old
   dev          initrd       proc         usr

What you are now looking at is the basic layout of the root file system.
The following describes what these directories are for: 

bin        - Location of system binary (executable files)

boot       - Contains information needed to boot your system (copies of
             your kernel, copies of your master boot record, maps of the
             memory locations on your hard drive telling the system where
             the boot programs and kernels reside, etc. 

cdrom      - If there is a CD in the CDROM drive and mounted, this is
             where you'd see its contents 

dev        - Device files (every piece of hardware looks like a file in
             UNIX and this contains the device filenames) 

etc        - Contains most of the configuration data for the machine
             In a sense this is the Unix version of the Windows registry.
             It is where the startup scripts, vaguely similar to the DOS
             autoexec.bat files, will be found.    

floppy     - If there is a floppy disk in the floppy drive and it is
             mounted, this is where you will find it's contents.

home       - This is where the users (you) work. It is one of the few
             places that you as a normal user are allowed to create
             directories and files.  When you log onto the system and
             start working you will be working in the directory
             /home/yourlogin.

initrd     - On my system this is empty.  I'd guess based on the name that
             this could be used to store the startup scripts or at least
             links to them.  Probably to offer compatibility with some
             other configuration schemes.  Otherwise my initialization
             scripts are stored under /etc/init.d.  (If someone has the
             definitive answer I'd like to know.) 

lib        - Software Libraries (Primarily "C") needed for system
             operation 

lost+found - Where lost files go. If you ever ran chkdisk in DOS you'll
             know about lost files.  If you shutdown your system
             incorrectly you may also learn about the lost+found
             directory.  This directory is created at the root of every
             file system you create when you issue the mkfs command.
             (Translating this to DOS - The lost+found directory is
             created by the format command (mkfs) when you format a
             partition.) 

mnt        - A generic mount point. In UNIX you mount drives and other devices on
             directories in the file system. In other words, you don't get
             drive letters like you do in DOS/Windows.  You can mount your
             CDROM or floppy here if you want to.

proc       - Process information. Information on what is going on inside
             the kernel. 

root       - The home directory for the root user 

sbin       - Executable binary files used primarily for system
             administration 

tmp        - Temporary disk space. Anyone can use this disk space but
             files written here aren't guaranteed to be permanent.  Many
             systems periodically purge the tmp directory.  Basically this
             is temporary storage space for programs.

usr        - User space. This is where most of the standard add-on 
             programs are stored 

var        - Where system monitor and log files get written. It is
             also, the location of the print queue, the mail queue (both
             inbound and outbound), and most lock files.    

vmlinuz    - This is the executable Linux Kernel itself!

vmlinuz.old - An old, no longer used kernel


That is probably quite enough for one e-mail. I encourage you to look
around. See what is here. Don't worry, only the root user can make changes
to many of these directories. You'll probably also find directories that
you can't access since you don't have the correct permissions. That is
normal and good. If you get lost, simply type

   cd     <return>

to get back to your home directory, or 

   cd /   <return>

to get back to the root directory. Have fun, and as always, if you have
questions please post them to the list. 

- Wayde
  (wallen at boulder.nist.gov)






More information about the LUG mailing list