如何查看特定目录的权限?

问题描述:

我知道使用 ls -l目录/目录/文件名 会告诉我文件的权限。如何在目录上执行同样的操作?

I know that using ls -l "directory/directory/filename" tells me the permissions of a file. How do I do the same on a directory?

我显然可以在更高目录中的目录上使用 ls -l 层次结构,然后滚动直到找到为止,但这真是太痛苦了。如果我在实际目录上使用 ls -l ,它将提供其中的文件的权限/信息,而不是实际目录的文件。

I could obviously use ls -l on the directory 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 of the actual directory.

我在Mac OS X 10.5和Linux(Ubuntu Gutsy Gibbon)的终端上都尝试过,结果是一样的。我应该使用某种标志吗?

I tried this in the terminal of both Mac OS X 10.5 and Linux (Ubuntu Gutsy Gibbon), and it's the same result. Is there some sort of flag I should be using?

这是简短的答案:

$ ls -ld directory

它的作用是:

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

请参考 在线手册页