Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a directory brothers which contains files John.txt and Max.txt. I can cd into and out of directory brothers with no problems. However, when I'm in brothers superdirectory (one level up) and I use the command ls -l it prints the following:

lrwxrwxrwx 1 root root 128 Jun 26 13:59 brothers -> filePathHere

As you can see from the first letter of the above output, the command ls -l thinks that brothers is a file rather than a directory. Shouldn't the first letter be a d (it shows a d for all of my other directories)? How can I fix this?

share|improve this question
1  
Lots of misinformation above. "l" represents a soft link. Hard links don't show up any differently than normal files in the "ls" command. And, soft links to a directory can be made by any user. –  Kent Jul 8 '13 at 23:12
    
@gnometorule l does not mean hard link, it just means link. Any user can create a soft link to a directory. –  terdon Jul 9 '13 at 2:20
    
Thanks for clarifying! I was careless, and will delete the comment; just adding this to not let your correction hang in the air. –  gnometorule Jul 9 '13 at 4:07

2 Answers 2

up vote 2 down vote accepted

To quote the man page of ls:

l = The entry is a symbolic link, and either the -N flag was specified or the symbolic link did not point to an existing file.

And for further reference d denotes a directory and - denotes an ordinary file.

share|improve this answer

'brothers' is a special type of file called a symbolic link. It's similar (though there are some differences) to a shortcut in Windows. when you cd to 'brothers', you're actually going to 'filePathHere'.

share|improve this answer
1  
what Nosrettap is seeing is a soft link and not a hard link. Symbolic links or soft links, unlike hard links, points to filename, not file data itself. –  user555 Jul 8 '13 at 23:04
    
corrected. Thank you. –  Jim G. Jul 8 '13 at 23:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.