UNIX
UNIX systems usage, administration and development information.

Guests are welcome to view our materials. To subscribe, edit, view raw markup, etc., you'll need to register for an account. Accounts are free (and will always be free) - your involvement helps us directly and indirectly (by demonstrating that our work matters to our funders...) StartingPoints has more info.
UNIX

Unix file and directory organization

Note that there can be slight variations from one system to another.

You can read detailed information (source of most of the info on this page) about the FHS (Filesystem Hierarchy Standard) and/or FSSTND (Filesystem Standard) here:

The following sites contain further information on FHS:

Directories essential for booting: /bin, /boot, /dev, /etc, /lib, /proc, /sbin


/

[edit]

  • the root directory
  • the following directories are found in a Filesystem Standard (FSSTND v2.3 January 29, 2004) compliant root directory:
           /bin
           /boot      
           /dev       
           /etc       
           /lib       
           /media     
           /mnt       
           /opt       
           /sbin      
           /srv       
           /tmp       
           /usr       
           /var 

[top]


/bin

[edit]

  • essential command binaries for both system administrators and regular users.
  • binaries such as: bash, cp, grep, gzip, ls, tar

[top]


/boot

[edit]

  • static files of the boot loader
  • GRUB directory
    • used for dual-boot or multi-OS boot system setups
    • GRUB will load a menu if it finds the menu.lst file (used for specifying which OS's are available to boot) here:
      /boot/grub/menu.lst

[top]


/dev

[edit]

  • device files

[top]


/etc

[edit]

/etc is a very important directory, containing various configuration and initialization files.

  • configuration files as defined by tldp: "A 'configuration file' is defined as a local file used to control the operation of a program; it must be static and cannot be an executable binary."
  • configuration files found in this directory for programs such as: Apache, cron, rpm, yum, ssh, etc.
  • some interesting sub-directories in /etc:
    • /etc/X11
      configuration file directory for X Window System

    • /etc/cron.d
      /etc/cron.daily
      /etc/cron.weekly
      /etc/cron.monthly
      contain scripts that the cron daemon executes on a temporal basis

    • /etc/httpd
      Apache configuration files

    • /etc/profile.d
      contains various shell scripts

    • /etc/rc.d
      files for control of system services and runlevels

      • /etc/rc.d/rc0.d
        specifies which services get started for runlevel 0
        • contains link files that point to various system service startup scripts in /etc/init.d or /etc/rc.d/init.d
        • all links start with either K or S:
          • K - this service will be killed if running, in this runlevel
          • S - this service will be started, in this runlevel

      • /etc/rc.d/rc1.d
        specifies which services get started for runlevel 1

      • /etc/rc.d/rc2.d
        specifies which services get started for runlevel 2

      • /etc/rc.d/rc3.d
        specifies which services get started for runlevel 3

      • /etc/rc.d/rc4.d
        specifies which services get started for runlevel 4

      • /etc/rc.d/rc5.d
        specifies which services get started for runlevel 5

      • /etc/rc.d/rc6.d
        specifies which services get started for runlevel 6

    • /etc/rc.d/init.d
      contains startup scripts for the daemons (or services) that are automatically started when the machine is booted
      • daemons such as: crond, denyhosts, httpd, ntpd, postfix, postgresql, sshd (see Daemons, Servers & Services WebHome for more info)
      • it is recommended that before you edit any scripts in this directory you should take a look at the man pages for: init, service, chkconfig, runlevel, inittab, and shutdown (see System Utilities WebHome for more info)

  • some interesting files in /etc:
    • /etc/bashrc
      system wide functions and aliases, determines the behavior of interactive shells

    • /etc/crontab
      cron configuration file

    • /etc/csh.cshrc
      csh configuration for all shell invocations

    • /etc/groups
      like /etc/passwd but for groups

    • /etc/inittab
      describes how the INIT process should set up the system in a certain run level

    • /etc/issue
      getty output prior to the login prompt - i.e. the system welcome message

    • /etc/mime.types
      listing of mime types and related extensions

    • /etc/motd
      "message of the day" - output message immediately after a successful login

    • /etc/passwd
      user database file with fields for username, home directory, other info for each user

    • /etc/php.ini
      php behavior settings file

    • /etc/profile
      system wide environment and startup programs

    • /etc/resolv.conf
      lists nameservers to use for host lookups

    • /etc/rsyslog.conf
      the main configuration file for the rsyslogd daemon which logs system messages - see man rsyslogd for more info

    • /etc/securetty
      identifies secure terminals from which root is allowed to log in. TLDP recommends that only virtual consoles are listed so that it is more difficult to gain root access via modem or network access.

    • /etc/shadow
      encrypted file which holds user passwords

    • /etc/shells
      list of trusted shells

    • /etc/services
      listing of internet services and ports used for each (i.e. ssh, http, ftp, etc.)

    • /etc/sudoers
      the sudoers file - lists users who can use sudo. See man sudoers for more info.

[top]


/home

[edit]

  • user directories (but not root - see /root )

[top]


/lib

[edit]

  • shared library images (C code library) needed to boot the system and run commands in the root filesystem (eg. /sbin and /bin)
  • kernel modules
    /lib/modules

[top]


/lost+found

[edit]

  • contains any recovered files after a system crash or power failure

[top]


/media

[edit]

  • contains mount points for removable media (i.e. floppy, cdrom, etc.)

[top]


/misc

[edit]

[top]


/mnt

[edit]

  • generic mount point where one can mount filesystems and/or devices

[top]


/net

[edit]

[top]


/opt

[edit]

  • optional packages not part of default installation (applications like office, etc.) according to the 2004 standard. Our experience is that we see it rarely used.

[top]


/proc

[edit]

  • files that provide status and statistics on system, kernel, and processes
  • it is a pseudo-filesystem which is used as an interface to kernel data structures
  • each running process has a directory in /proc that corresponds to it's PID from which you can extract info about the process - see man proc for more info

[top]


/root

[edit]

  • root's home directory

[top]


/sbin

[edit]

  • system programs (for system administration, etc.)
  • FSSTND states /sbin should contain only binaries essential for booting, restoring, recovering and/or repairing the system in addition to the binaries in /bin
  • programs like: service, ip, init, chkconfig
  • some "less important" system/admin programs can be found in /usr/sbin
  • locally installed system admin programs should be placed in /usr/local/sbin

[top]


/selinux

[edit]

[top]


/srv

[edit]

  • site-specific data

[top]


/sys

[edit]

[top]


/tmp

[edit]

  • temporary files
  • files in this directory should not be assumed to survive a restart or even invocations of any program

[top]


/usr

[edit]

  • contains all user binaries, their documentation, libraries, header files, etc. - contains only static data (as opposed to /var which contains variable data)
  • some interesting subdirectories in /usr :
    • /usr/bin
      contains most binaries on the system (i.e. diff, emacs, gzip, g++, svn, etc.)

    • /usr/include
      header files for C programming language and header files used by various programs on the system

    • /usr/lib
      program libraries (collections of frequently used routines) - library of unchanging data files for programs

    • /usr/local
      locally installed software - reserved for the use of the local admin(s).

    • /usr/sbin
      system admin commands not needed on the root filesystem (i.e. most server programs such as: chrond, httpd, sshd, etc.)

    • /usr/share/doc
      miscellaneous documentation files

    • /usr/share/info
      GNU info documents

    • /usr/share/man
      manual pages

    • /usr/src
      a linux or Redhat or some such similar subdirectory contains the Linux kernel source, header files and docs

    • /usr/X11R6
      files for the X Window System

[top]


var

[edit]

  • variable data dynamic files, such as: system log files, mail/printer spool directories, etc.
  • some interesting subdirectories or files:
    • /var/cache
      cached data from applications (usually stored from time-consuming I/O or calculations)

    • /var/lib
      application dynamic data libraries/files

    • /var/local
      variable data for local programs installed in /usr/local

    • /var/lock
      lock files for devices being used by a program

    • /var/log
      log files

      • /var/log/auth.log
        record of all logins and logouts by users and system processes

      • /var/log/btmp
        log of all attempted bad logins to the system (use lastb command)

      • /var/log/cron
        cron messages

      • /var/log/httpd
        apache server messages

        • /var/log/httpd/access_log
          log of accesses to the apache server

        • /var/log/httpd/error_log
          log of errors, very useful for debugging server operation

        • /var/log/httpd/rewrite_log
          helpful with debuggin mod_rewrite issues

        • /var/log/httpd/ssl_access_log


        • /var/log/httpd/ssl_error_log


        • /var/log/httpd/ssl_rewrite_log


      • /var/log/messages
        system logs

    • /var/mail
      user mailbox files

    • /var/named
      database for BIND (Berkeley Internet Name Domain), an Internet domain name server

    • /var/opt
      data of application installed in /opt (i.e. optional packages not part of the default installation)

    • /var/spool
      spool files for mail, news, printing (lpd), etc.

    • /var/tmp
      temporary files - can be held for longer period of time than in /tmp

    • /var/log/wtmp
      log of all users who logged into and out of the system (use last command)

    • /var/yp
      database for NIS (Network Information Services)

[top]


-- RobertSajan - 20 May 2008

r23 - 11 Dec 2008 - 23:31:47 - RobertSajan
Guests are welcome to view our materials. To subscribe, edit, view raw markup, etc., you'll need to register for an account. Accounts are free (and will always be free) - your involvement helps us directly and indirectly (by demonstrating that our work matters to our funders...) StartingPoints has more info.
This site is powered by the TWiki collaboration platformCopyright 1999-2009 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Ahatwiki? Send feedback Syndicate this site RSSATOM