Determine the directory structure of a system

Author: name contact BSD flavour

Reviewer: name contact BSD flavour

Reviewer: name contact BSD flavour


Be able to quickly determine the directory layout used by BSD systems.


Of course, the cd, find(1) and ls(1) commands can be used to explore the directory layout of the BSD system. The following are the main directories found on a standard BSD system:

  • / the main directory, the root of the filesystem
  • /bin/ essential user commands
  • /dev/ special device files TODO: is mknod and device files covered in this book? If so point to it
  • /etc/ various configurations, user databases, and startup scripts
  • /home/ the "home" (default login) directories owned by users
  • /sbin/ essential system and administration tools
  • /tmp/ scratch space for temporary files
  • /usr/ most of the applications, documentation, and application data files
  • /var/ log files, mail and printer spools, system databases, and other frequently changing data

TODO: cross-reference to section that covers it better

TODO: /lib/, /libexec/

TODO: list some of the main directories and explain (see hier(7))

For more details, read the hier(7) manual page which provides an outline of filesystem hierarchy. (((hierarchy))) (((filesystem hierarchy))) (((hier))) The man page lists common directories and with basic explanations. (TODO: FOOTNOTE: The NetBSD hier(7) manual also lists common files.)

The locate, find, and which commands and the PATH environment variable can also be useful for becoming familiar with a system; they are introduced in section Locate files and binaries on a system.


Practice Exercises

  1. List the directories under /etc/.
  2. Compare the directory layout under /usr/ with the /. TODO: reword this
  3. Do a directory listing in each of the main directories listed earlier. TODO: listed above?

More information