ls -la shows files pointing to another file

Posted on 2014-08-27
Last Modified: 2014-08-28
I am not sure how to achieve this but when i type ls -la i get some files like this

default -> ../sites-available/default with the following permissions  lrwxrwxrwx

how do i create the same file that links to another file.
Question by:stargateatlantis
    LVL 13

    Expert Comment

    This is soft link.. to create such file follow the below example


    1. #touch file1
    2. #ln -s file1 file2

    in above example file2 will be pointing to file1.. this is what soft link and there is another type of link called hard link.. which can be created using below command

    3. #ln file1 file3

    the difference between soft and hard link is ... Hard link shares the same inode number where in soft link has its own inode number can be checked with below command.

    4. # ls -lai

    LVL 27

    Accepted Solution

    What you see is a soft link.  Hard links look like regular files and don't include that redirect.  You can just delete the link with a regular rm command

    In addition to Sandy's comment, hard links must also reside on the same disk partition.  Soft links can be anywhere.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
    I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension ( This reminded me of questions tha…
    Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now