Files and Directories

When files are created on a filesystem they are stored inside a directory. A directory is simply a file that has a particular format. It is stored on the disk in the same way as ordinary files. The only reason you can't edit them like an ordinary file is because the editor programs (such as vi) specifically stop you from doing so. We will use the directory /var/adm as an example to demonstrate the structure of a directory.

As you know, the ls command is provided to list the contents of a directory:

hydrogen# cd /var/adm
hydrogen# ls
aculog     log        passwd     sulog      utmpx      wtmp
lastlog    messages   spellhist  utmp       vold.log   wtmpx
hydrogen#

This has shown us the names of the files and directories that are in the directory /var/adm, but ...

Get Solaris™ Operating Environment Boot Camp now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.