next up previous contents
Next: How to view Up: Files & Directories Previous: Files & Directories

Directory Contents

Directories store names of files and a reference to the actual file or names of directories and a reference to the other directory. The lsgif command is used to display the contents of a directory. Given the example in figure gif the ls command will produce the following output:

$ls
a         b         c         data      junk      programs
$

This gives us just the names of the files and directories. To get a better idea of what are files and what are directories we can use an additional parameter to the ls command:

$ls -F
a          b          c          data/      junk/      programs/  
$

  
Figure: A Sample directory sub-tree

We can now see that the subdirectories have all been appended with a '/'. To get even more information we can add another parameter:

$ls -Fl
total 3
-rw-------   1 markst   staff           0 Jan 21 17:13 a
-rw-------   1 markst   staff           0 Jan 21 17:07 b
-rw-------   1 markst   staff           0 Jan 21 17:07 c
drwx------   3 markst   staff        1024 Jan 21 17:11 data/
drwx------   2 markst   staff        1024 Jan 21 17:11 junk/
drwx------   2 markst   staff        1024 Jan 21 17:10 programs/
$

This is the most informative directory display available on most UNIX systems. The first column contains the file type and access permissions and type of directory entry. The second column specifies he number of hard links, which will be explained later. The third and fourth column specifies the owner and group. The fifth column shows the file size. The sixth column shows the last modification date and time. The last column finally shows the name of the directory entry.



Mark O. Stitson
Wed Sep 25 10:45:32 BST 1996