Ln (Unix) - Usage - Symbolic Link Creation and Deletion

Symbolic Link Creation and Deletion

The following shows the creation of a symbolic link slink.txt:

$ ln -s data.txt slink.txt $ ls -li 969768 -rw-r--r-- 1 alex alex 10 Dec 9 09:11 data.txt 969817 lrwxrwxrwx 1 alex alex 8 Dec 9 09:11 slink.txt -> data.txt

The symbolic (soft) link is stored in a different inode than the text file (969817). The information stored in data.txt is accessible through the slink.txt:

$ file slink.txt slink.txt: symbolic link to `data.txt' $ cat slink.txt some data

If we delete the text file data.txt, slink.txt becomes a broken link and our data is lost.

$ rm data.txt $ ls -li 969817 lrwxrwxrwx 1 alex alex 8 Dec 9 09:11 slink.txt -> data.txt $ file slink.txt slink.txt: broken symbolic link to `data.txt' $ cat slink.txt cat: slink.txt: No such file or directory

Read more about this topic:  Ln (Unix), Usage

Famous quotes containing the words symbolic, link and/or creation:

    I find it profoundly symbolic that I am appearing before a committee of fifteen men who will report to a legislative body of one hundred men because of a decision handed down by a court comprised of nine men—on an issue that affects millions of women.... I have the feeling that if men could get pregnant, we wouldn’t be struggling for this legislation. If men could get pregnant, maternity benefits would be as sacrosanct as the G.I. Bill.
    Letty Cottin Pogrebin (20th century)

    Before I had my first child, I never really looked forward in anticipation to the future. As I watched my son grow and learn, I began to imagine the world this generation of children would live in. I thought of the children they would have, and of their children. I felt connected to life both before my time and beyond it. Children are our link to future generations that we will never see.
    Louise Hart (20th century)

    There have been heroes for whom this world seemed expressly prepared, as if creation had at last succeeded; whose daily life was the stuff of which our dreams are made, and whose presence enhanced the beauty and ampleness of Nature herself.
    Henry David Thoreau (1817–1862)