Miscellaneous
  Home arrow Miscellaneous arrow Page 3 - UNIX File Systems
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MISCELLANEOUS

UNIX File Systems
By: Gabor Bernat
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2009-03-18

    Table of Contents:
  • UNIX File Systems
  • File Types
  • The File System and Important Directories
  • Working with Directories and Files
  • Devices

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    UNIX File Systems - The File System and Important Directories


    (Page 3 of 5 )

    The directory is also a file, even though it only contains directory entries. If you want to find out what files and directories are under it, you just have to open it and view its entries. The File System comprises the hierarchically-ordered files and directories. At the root of everything is the root directory.

    The root directory is represented by a single / character. Beyond this, like a tree, are the files and the directories. Every directory has two special directories. One, represented by a single point, points at the directory itself, while a second, represented by two points, refers to the directory above. In the case of the root directory, of course, these are missing.

    In case someone uses it, note that it will point back to the root directory (i.e. /bin, ../bin/ and ../../bin will point to the same directory). Below the root directory, the files are sorted into categories, so you can easily find what you're searching for. This is subject to change depending upon your UNIX/Linux distribution; however, mainly this is the way distributions work.

    /boot => The kernel and the files required for the start of programs

    /home => The users own directory

    /dev => The devices

    /tmp => The temporary files

    /var => Files that expand

    /bin => The binary files

    /sbin => Binaries that only the super user can execute

    /proc => The kernel maintains this and it contains information about the processes

    /usr => Important files used by the system and the user

    For example /usr/lib the libraries

    /usr/include the C header files

    /usr/bin Files that can run

    /usr/src The source files

    When we work with files, there are two important directories. One is the current working directory; the one that is used by the shell to put work into. The second one is the home directory of the user. This can be replaced with the ~ character. Therefore, the ~/alfa will refer to the alfa file/directory of my home directory. Of course, if my work directory is the home one, I can also refer to alfa with just a simple alfa.

    This relative place of files based on where our current work directory is allows us to make a difference between the absolute and relative path to a file. The absolute path is the completely explicit route, while the relative path is based on where I am. Whatever the case is, the route is just a sequence of characters separated by the character /.

    There is a command that will extract from a path the name of the file, and another one that will extract the route to the file. The first is entitled basename while the second is called dirname. The following examples will illustrate how they work.

    basename /home/gaborj/alfa.cpp

    With the result of:

    alfa.cpp

    dirname /home/gaborj/alfa.cpp

    With the echo of:

    /home/gaborj

    Note that giving an extension to files in UNIX is not required. Still, it is recommended to further help us separate and categorize our files.

    More Miscellaneous Articles
    More By Gabor Bernat


       · Good article; clear, simple, kind of beautiful!One error: In section 4, "Working...
       · Why do you say that Windows NT is object-based filesystem, and NOT hierarchical like...
     

    MISCELLANEOUS ARTICLES

    - Using PHP to Stream MP3 Files and Prevent Il...
    - 10 Must Have Firefox Improvements
    - All About OpenOffice 3.0
    - Shell Script Writing
    - Loops in the UNIX Shell
    - The Test in the UNIX Shell
    - Data Streams and the UNIX Shell
    - Control Mechanisms of the UNIX Shell
    - Variables Within the UNIX Shell
    - The Shell and UNIX
    - In Detail: UNIX File Systems
    - Rights Management in UNIX
    - UNIX File Systems
    - The Terminal in UNIX
    - Operating Systems and UNIX





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek