Miscellaneous
  Home arrow Miscellaneous arrow Page 4 - In Detail: 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

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

    Table of Contents:
  • In Detail: UNIX File Systems
  • Mounting file systems
  • Links in UNIX
  • The standard files and directions
  • File names on the shell command line

  • 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


    In Detail: UNIX File Systems - The standard files and directions


    (Page 4 of 5 )

     

    They are three standard files: stdin, stdout and stderr. These files are for input, output and the error echo, respectively. Every application will maintain these files. Furthermore, it is a generally accepted fact that new programs should be written such that, by default, if we do not give to it an input they will read from the stdin, print on the stdout and signal errors on the stderr. 

    We call all the programs that follow this idea "filters." An integer number also codes to this tree inputs that are automatically opened by the operating system. The standard input is zero, the standard output is one and the standard error is two.  

    The shell allows you to change where files put their input and output. It can direct some files to a program as input or direct its output to a file. For input, use the > followed by the file name. For output we direct in the other direction, and use the > character followed by the file name.  

    These three standard files do not have names yet; so we can reach them, they exist via the /dev/stdin, /dev/stdout and /dev/stderr devices. Redirecting via these will also create a new file and add it to the output. To avoid this, and just append the new data to the end of a file, use the >>.  

    I will use this moment to also introduce the cat command. This will echo back the content of a file you point to it. This is a filter. If you use it with no arguments, it will use the stdin (the terminal itself) until you signal the end of file (Ctrl + D). After this, it will print back whatever you entered.  

    #print back the content of alfa

    cat alfa

     

    #use as input the alfa and as output the beta

    cat <alfa >beta

     

    # now we will append the content of alfa to beta

    cat <alfa >>beta

     

    #input alfa, output remains default, error to null device

    cat 0<alfa 2>/dev/null

    The last one is a little more interesting. This shows that we can also point something to direct to somewhere. We use the integer codification of the standard files as I described above. Also note that by directing the error output to the null device, we virtually ignore them, as the null device will eat up everything you throw at it. 

    More Miscellaneous Articles
    More By Gabor Bernat


     

    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 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek