[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 171
  • Last Modified:

ls -la shows files pointing to another file

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.
1 Solution
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

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

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now