Miscellaneous

  Home arrow Miscellaneous arrow Page 3 - In Detail: UNIX File Systems
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

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    In Detail: UNIX File Systems - Links in UNIX


    (Page 3 of 5 )

     

    There are two types of links in UNIX: symbolic and hard. This can make it easier to work with files as we are creating new names for them and shortcuts to certain files. A hard link means that we're giving another name to the file. The two names have the same value. In this case, if we delete one of them, the file remains, regardless of which one was created first. 

    We can delete a file/directory only after we have deleted all of its hard links. When we create a link, we just give another name to the file. If we delete either of its names, the other will be still valid. You can create this type of link only within the same partition. 

    Symbolic links, on the other hand, are just pointers to the file. If we delete the original file, the link will remain and point nowhere. We can create any number of links. There are no restrictions. Symbolic links can point across partitions. We use the ln command to create links.

    The syntax of the command looks as follows: 

    ln [what file/directory] [what new name/link]

    By default, the links are hard. If we want to create a symbolic link we need to add the -s option. For example, in the following lines, I will create a symbolic and a hard link to the alfa file. 

    ln alfa beta

    ln -s alfa omega

    Notice in the example below that the two hard links have the same i-node numbers, meaning they are exactly the same file under different names. The ls command also echoes back symbolic links, as you can see. These will display in a different color when they are invalid. Also, observe the same i-node numbers for alfa and beta in the image below:

     

    More Miscellaneous Articles
    More By Gabor Bernat

    blog comments powered by Disqus

    MISCELLANEOUS ARTICLES

    - Oracle Database XE: Indexes and Sequences
    - Modifying Tables in Oracle Database XE
    - Oracle Database XE: Tables and Constraints
    - More on Oracle Databases and Datatypes
    - Oracle Database XE Datatypes: Datetime and L...
    - Oracle Database XE Datatypes: Character and ...
    - From Databases to Datatypes
    - Firefox 3.6.6 Released with Improved Plug-in...
    - Attention Bloggers: WordPress 3.0 Now Releas...
    - Reflection in PHP 5
    - Inheritance and Other Advanced OOP Features
    - Advanced OOP Features
    - Linux from Scratch V.6.6 Review
    - Linux Gaining in Strength
    - Install Slackware on Your Old PC


    © 2003-2012 by Developer Shed. All rights reserved. DS Cluster 11 - Follow our Sitemap