Linux File System Layout


The Linux file system layout is very similar to the other UNIX variants described earlier, both in concept and in implementation. Files are contained in directories, and directories can have any number of subdirectories. Most operating systems are arranged this way, including UNIX.

The following is a long listing at the root level of a Caldera Linux system:

 #  ls -l /  total 439 -rw-rw-rw-   1 root     root        23 Nov  5 07:10 .lgdb dr-xr-xr-x   3 root     root       1024 Nov  5 07:10 amd dr-xr-xr-x   2 root     root        512 Nov  5 07:10 auto drwxr-xr-x   2 root     root       2048 Nov  5 07:12 bin drwxr-xr-x   2 root     root       1024 Nov  5 01:44 boot drwxr-xr-x   2 root     root      10240 Nov  6 22:27 dev drwxr-xr-x  15 root     root       2048 Nov  7 00:15 etc drwxr-xr-x   5 root     root       1024 Nov  5 01:43 home drwxr-xr-x   2 root     root       1024 Nov  5 01:29 initrd lrwxrwxrwx   1 root    root         11 Nov  5 01:29 install ->                                                   /var/lib/LST drwxr-xr-x   4 root     root       1024 Nov  5 01:44 lib drwxr-xr-x   2 root     root     12288 Nov  5 01:29 lost+found drwxr-xr-x   4 root     root       1024 Nov  5 01:44 mnt drwxr-xr-x   4 root     root       1024 Sep 10  1996 opt dr-xr-xr-x   5 root     root          0 Nov  5 01:59 proc drwxr-xr-x   5 root     root       1024 Nov  6 20:56 root drwxr-xr-x   2 root     root       2048 Nov  7 00:03 sbin drwxrwxrwt   6 root     root       1024 Nov  7 00:10 tmp drwxr-xr-x  21 root     root       1024 Nov  5 01:40 usr drwxr-xr-x  14 root     root       1024 Nov  5 01:32 var -rw-r--r--   1 root     root     404158 Nov  5 01:29 vmlinuz 

Most of the directories are the same as those described earlier. A couple of directory names did not appear earlier that are significant, however. The Linux kernel, vmlinuz , appears at the root level. The directory /root is the home directory of the user root.

The /proc directory contains information about the Linux system. The /proc directory is really a set of data structure information that looks like a directory. The following is a long listing of the /proc directory:

 #  ls -l /proc  total 0 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 1 dr-xr-xr-x   3 root     root            0 Nov  7 00:16 1011 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 104 dr-xr-xr-x   3 bin      root            0 Nov  7 00:13 106 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 116 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 118 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 146 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 155 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 156 dr-xr-xr-x   3 daemon   root            0 Nov  7 00:13 162 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 167 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 170 dr-xr-xr-x   3 root     65535           0 Nov  7 00:13 178 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 18 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 19 dr-xr-xr-x   3 nobody   65535           0 Nov  7 00:13 193 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 199 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 2 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 20 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 200 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 201 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 202 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 203 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 204 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 205 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 21 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 273 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 274 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 276 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 3 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 307 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 327 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 358 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 375 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 443 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 444 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 445 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 45 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 482 dr-xr-xr-x   3 root     root            0 Nov  7 00:13 483 dr-xr-xr-x   3 root     root            0 Nov  7 00:16 996 dr-xr-xr-x   3 root     root            0 Nov  7 00:16 997 dr-xr-xr-x   3 root     root            0 Nov  7 00:16 998 -r--r--r--   1 root     root            0 Nov  7 00:13 cmdline -r--r--r--   1 root     root            0 Nov  7 00:13 cpuinfo -r--r--r--   1 root     root            0 Nov  7 00:13 devices -r--r--r--   1 root     root            0 Nov  7 00:13 dma -r--r--r--   1 root     root            0 Nov  7 00:13 filesys -r--r--r--  1 root     root            0 Nov  7 00:13 interrupt -r--r--r--   1 root     root            0 Nov  7 00:13 ioports -r--------   1 root     root     33558528 Nov  7 00:13 kcore -r--------   1 root     root            0 Nov  5 07:00 kmsg -r--r--r--   1 root     root            0 Nov  7 00:13 ksyms -r--r--r--   1 root     root            0 Nov  7 00:05 loadavg -r--r--r--   1 root     root            0 Nov  7 00:13 locks -r--r--r--   1 root     root            0 Nov  7 00:13 mdstat -r--r--r--   1 root     root            0 Nov  7 00:13 meminfo -r--r--r--   1 root     root            0 Nov  7 00:13 modules -r--r--r--   1 root     root            0 Nov  7 00:13 mounts dr-xr-xr-x   2 root     root            0 Nov  7 00:13 net -r--r--r--   1 root     root            0 Nov  7 00:13 pci dr-xr-xr-x   2 root     root            0 Nov  7 00:13 scsi lrwxrwxrwx   1 root     root           64 Nov  7 00:13 self->110 -r--r--r--   1 root     root            0 Nov  7 00:13 stat dr-xr-xr-x   5 root     root            0 Nov  7 00:13 sys -r--r--r--   1 root     root            0 Nov  7 00:13 uptime -r--r--r--   1 root     root            0 Nov  7 00:13 version 

The directories in the long listing, which have a " d" at the beginning of the line, are processes. The file /proc/kcore represents the physical memory of your Linux system. Files in /proc contain some interesting information about your system. One file you'll want to take a look at is the /proc/cpuinfo file. An example of this file is shown in the following listing:

 #  more /proc/cpuinfo  processor      : 0 cpu            : 686 model          : 3 vendor_id      : GenuineIntel stepping       : 4 fdiv_bug       : no hlt_bug        : no fpu            : yes fpu_exception  : yes cpuid          : yes wp             : yes flags          : fpu vme de pse tsc msr pae mce cx8 11 mtrr pge mca cmov mmx bogomips       : 266.24 

more is covered in the next chapter. For now, you just need to know that more is used for viewing files.

The /boot directory contains the Linux kernel and other files used by the LILO boot manager. The following is a listing of /boot :

 #  ls -l /boot  total 452 -rw-r--r--   1 root     root     15954 Feb 11  1997 WHATSIN -rw-r--r--   1 root     root     15954 Feb 11  1997                                        WHATSIN-2.0.29-modular -rw-r--r--   1 root     root        204 Jul 24  1996 any_b.b -rw-r--r--   1 root     root        204 Jul 24  1996 any_d.b -rw-r--r--   1 root     root        512 Nov  5 01:44 boot.0300 -rw-r--r--   1 root     root       4416 Jul 24  1996 boot.b -rw-r--r--   1 root     root         88 Jul 24  1996 chain.b -rw-------   1 root     root       7680 Nov  5 01:44 map -r--r--r--   1 root     root       1565 Mar  7  1997 message -rw-r--r--   1 root     root        192 Jul 24  1996 os2_d.b -rw-r--r--   1 root     root     404158 Feb 11  1997 vmlinuz-                                                 2.0.29-modular 

As a user, you are probably most concerned with your home directory, assigned to you by your system administrator, which is most likely in the /home directory. I think, however, that as a UNIX user you need to understand the overall UNIX file system layout. Keep in mind that you may find minor differences in the file system layout going from one UNIX variant to another, but in general the layout is similar.

If you're running a graphical user interface on your Linux system, you can view the file system graphically. Figure 20-2 shows the Red Hat Linux File Manager which is part of the Gnome user interface.

Figure 20-2. File Manager in Gnome Showing the Red Hat Linux File System

graphics/20fig02.jpg

You can see that many of the directories shown on the left-hand side of Figure 20-2 are the same as those described earlier for UNIX systems in general. Although you may be working with any number of different UNIX variants, you'll find most of the system structures to be similar.



HP-UX 11i Systems Administration Handbook and Toolkit
HP-UX 11i Systems Administration Handbook and Toolkit (2nd Edition)
ISBN: 0131018833
EAN: 2147483647
Year: 2003
Pages: 301

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net