tags:

views:

4841

answers:

3

So I'm learning Unix at the moment....

Now I know that using ls -l "directory/directory/filename" tells me the permissions of a file... how do I do the same on a folder? I could obviously use ls -l on the folder higher in the hierarchy and then just scroll till I find it but it's such a pain. If I use ls -l on the actual directory, it gives the permissions/information of the files inside of it, and not the actual folder. I tried this in the terminal of both Mac OS X 10.5 and Linux (Ubuntu Gutsy Gibbon), and it's the same results. Is there some sort of flag I should be using? Thanks in advance.

+6  A: 

Here is the short answer:

$ ls -ld directory

Here's what it does:

-d, --directory
    list directory entries instead of contents, and do not dereference symbolic links

You might be interested in manpages. That's where all people in here get their nice answers from.

Johannes Schaub - litb
+1  A: 

You can also use the stat command if you want detailed information on a file/directory. (I precise this as you say you are learning ^^)

Piotr Lesnicki
+1  A: 

In addition to the above posts, i'd like to point out that "man ls" will give you a nice manual about the "ls" ( List " command.

Also, using ls -la myFile will list & show all the facts about that file.

Filip Ekberg