UNIX File System Hierarchy

This section provides a quick introduction of UNIX file system hierarchy.

On a UNIX system, almost all resources are represented as files in a single file system hierarchy.

For example, the first floppy disk drive is represented as a device file: /dev/fd0. Data can be read from and write to a floppy disk directly through /dev/fd0. But if a floppy disk has file system structure, it can also be mounted to the file system hierarchy.

The "df" command displays usage information of physical storage devices that are mounted on the current file system hierarchy:

Filesystem   1024-blocks     Used   Available   Capacity   Mounted on
/dev/hda1         198275   134358       53672        71%   /
/dev/hda3          92333        1       87564         0%   /mnt/backup
/dev/df0            1676      960         716        57%   /mnt/floopy

The output tells us that 3 storage devices with file systems are mounted on the file system hierarchy:

UNIX system also has a very interesting special file called /dev/null, representing an empty file for reading and a black hole for writing. /dev/null is very useful for truncating log files that are currently in use. Here is an example of commands to rotate the mail.log file once a day on a Solaris system:

#vi /usr/lib/newsyslog
   cd /var/log
   test -f mail.log.2 && mv mail.log.2 mail.log.3
   test -f mail.log.1 && mv mail.log.1 mail.log.2
   test -f mail.log.0 && mv mail.log.0 mail.log.1
   mv mail.log mail.log.0
   cp /dev/null /var/log/mail.log
   chmod 644 /var/log/mail.log
   kill -HUP `cat /etc/syslog.pid`

#crontab -e root 
   59 23 * * 6 /usr/lib/newsyslog

Table of Contents

 About This Book

 1957 - FORTRAN Language Developed by IBM

1970 - UNIX Operating System Developed by AT&T Bell Labs

 What Is UNIX?

 Command Interpreters and Command Pipelines

UNIX File System Hierarchy

 1971 - FTP Protocol Created by Abhay Bhushan

 1972 - C Language Developed by Dennis Ritchie

 1976 - vi Text Editor Developed by Bill Joy

 1977 - Apple II Designed by Steve Jobs and Steve Wozniak

 1977 - The Bourne Shell Developed by Stephen Bourne

 1978 - The C Shell Developed by Bill Joy

 1978 - Bash (Bourne-Again Shell) Developed by Brian Fox

 1979 - The Tcsh (TENEX C Shell) Developed by Ken Greer

 1983 - "Sendmail" Mail Transfer Agent Developed by Eric Allman

 1984 - Macintosh Developed by Apple Inc.

 1984 - X Window System Developed a MIT Team

 1991 - WWW (World Wide Web) Developed by Tim Berners-Lee

 1991 - Gopher Protocol Created by a University of Minnesota Team

 1995 - Java Language Developed by Sun Microsystems

 1995 - PHP: Hypertext Preprocessor Created by Rasmus Lerdorf

 2002 - .NET Framework Developed by Microsoft


 PDF Printing Version