Page 277 - DCAP403_Operating System
P. 277
Operating System
Notes This kind of layout, known as the unifi ed filesystem, does offer several advantages over the
approach that Windows uses. Let’s take the example of the /usr directory. This directory off the
root directory contains most of the system executables. With the Linux filesystem, you can choose
to mount it off another partition or even off another machine over the network. The underlying
system will not know the difference because /usr appears to be a local directory that is part of
the local directory structure! How many times have you wished to move around executables and
data under Windows, only to run into registry and system errors? Try moving c:windowssystem
to another partition or drive.
Another point likely to confuse newbies is the use of the frontslash ‘/’ instead of the backslash
‘’ as in DOS/Windows. So c:windowssystem would be /c/windows/system. Well, Linux is not
going against convention here. Unix has been around a lot longer than Windows and was the
standard a lot before Windows was. Rather, DOS took the different path, using ‘/’ for command-
line options and ‘’ as the directory separator.
To liven up matters even more, Linux also chooses to be case sensitive. What this means that
the case, whether in capitals or not, of the characters becomes very important. So this is not the
same as THIS or ThIs for that matter. This one feature probably causes the most problems for
newbies.
We now move on to the layout or the directory structure of the Linux filesystem. Given below is
the result of a ‘ls -p’ in the root directory.
bin/ dev/ home/ lost+found/ proc/ sbin/ usr/ boot/ etc/ lib/ mnt/ root/ tmp/
var/
/sbin: This directory contains all the binaries that are essential to the working of the system. These
include system administration as well as maintenance and hardware confi guration programs.
Find lilo, fdisk, init, ifconfig etc here. These are the essential programs that are required by all the
users. Another directory that contains system binaries is /usr/sbin.
This directory contains other binaries of use to the system administrator.
This is where you will find the network daemons for your system along with other binaries that
only the system administrator has access to, but which are not required for system maintenance,
repair etc.
/bin: In contrast to /sbin, the bin directory contains several useful commands that are used by
both the system administrator as well as non-privileged users. This directory usually contains
the shells like bash, cash etc. as well as much used commands like cp, mv, rm, cat, ls. There also
is /usr/bin, which contains other user binaries. These binaries on the other hand are not essential
for the user. The binaries in /bin however, a user cannot do without.
/boot: This directory contains the system.map file as well as the Linux kernel. Lilo places the boot
sector backups in this directory.
/dev: This is a very interesting directory that highlights one important characteristic of the Linux
filesystem - everything is a file or a directory. Look through this directory and you should see
hda1, hda2 etc, which represent the various partitions on the first master drive of the system. /
dev/cdrom and /dev/fd0 represent your CDROM drive and your floppy drive. This may seem
strange but it will make sense if you compare the characteristics of files to that of your hardware.
Both can be read from and written to. Take /dev/dsp, for instance. This file represents your
speaker device. So any data written to this file will be re-directed to your speaker. Try ‘cat /etc/
lilo.conf > /dev/dsp’ and you should hear some sound on the speaker. That’s the sound of your
lilo.conf file! Similarly, sending data to and reading from /dev/ttyS0 (COM 1) will allow you to
communicate with a device attached there - your modem.
/etc: This directory contains all the confi guration files for your system. Your lilo.conf file lies in
this directory as does hosts, resolv.conf and fstab. Under this directory will be X11 sub-directory
270 LOVELY PROFESSIONAL UNIVERSITY