Subscribe:

Ads 468x60px

Pages

Tuesday, December 27, 2011

Unix Directory Structure

Question: What is the standard directory structure on a UNIX computer?
Answer: The following is a generalized overview.
  • / — the slash / character alone denotes the root of the virtual filesystem tree.
    • /bin — stands for "binaries" and contains certain fundamental utilities, such as ls or cp, needed by all users.
    • /sbin — stands for "system (or "superuser") binaries" and contains fundamental utilities, such as init, usually needed to start, maintain and recover the system.
    • /etc — contains configuration files and system databases.
    • /dev — stands for "devices". Contains file representations of peripheral devices.
    • /dev/null — also known as the "bit bucket" or "black hole", this pseudo device discards all contents written to it, and is typically used to pipe away unwanted data.
    • /dev/random — this pseudo device returns pseudorandom numbers when read from.
    • /dev/urandom — similar to /dev/random, except it always returns (less cryptographically-strong) pseudorandom numbers, even if there is not enough entropy in the system noise available.
    • /home — contains the home directories for the users.
    • /mnt — contains filesystem mount points.
    • /lib — contains system libraries.
    • /root — the home directory for the superuser root.
    • /tmp — a place for temporary files. Many Unices clear this directory upon start up.
    • /usr — originally the directory holding user home directories, its use has changed, and it now holds executables, libraries, and shared resources that are not system critical, like the X Window System, KDE, Perl, etc.
    • /usr/bin — this directory stores all binary programs distributed with the operating system not residing in /bin, /sbin or (rarely) /etc.
    • /usr/include — /usr/include stores the development headers used throughout the system.
    • /usr/lib — stores the required libraries for executables within /usr or elsewhere.
    • /usr/local — resembles /usr, except that its subdirectories are used for additions not part of the operating system distribution, such as custom programs or files from a BSD Ports collection. Usually has subdirectories such as /usr/local/lib or /usr/local/bin.
    • /var — a short for "variable." A place for files that may change often.
    • /var/log — contains system log files.
    • /var/mail — the place where all the incoming mails are stored. The user can access his/her own mail only, unless he/she has admin rights.
    • /var/spool — spool directory; contains print jobs, mail spools and other queued tasks.
    • /var/tmp — A place for temporary files preserved between system reboots.
    • /proc — contains all processing data (Process information about a running operating system).
    • /opt — contains add-on software.
    • /media — default mount point for removable devices.
    • /srv — server data (data for services provided by system).
    • /boot — contains all the important files which are required for successful booting process.
    • /sys — contains information related to hardware.