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?
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.
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?
Or to get the info of all files and folder inside that directory: PS C:\Users\Username> Dir | Get-Acl Directory: C:\Users\Username Path Owner Access ---- ----- ------ . anaconda Owner Name NT AUTHORITY\SYSTEM Allow FullControl... . android Owner Name NT AUTHORITY\SYSTEM Allow FullControl... .
To view effective permissions on files and foldersRight-click the file or folder, click Properties, and then click the Security tab. Click Advanced, click the Effective Permissions tab, and then click Select. In Enter the object name to select (examples), enter the name of a user or group, and then click OK.
The -perm parameter of the find command can be used to find the files with specific permissions. The 2 ways to specify the permissions with the -perm parameter are : -perm -mode --- All of the permission bits mode are set for the file. -perm /mode --- Any of the permission bits mode are set for the file.
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.
refer to online man pages
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 ^^)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With