Blog.

How to get permissons of a file/directory

If you want to see permissions of a file or a directory in both human readable and octal notation issue this command:

 

Linux:

stat -c "%n %a %A" /tmp # replace /tmp with your file/dir

The output is as follows:

/tmp 1777 drwxrwxrwt

 

 

Mac OS X:

stat -f "%N %A %Sp" /private/tmp # replace /private/tmp with your file/dir

The output is as follows:

/private/tmp 1777 drwxrwxrwt

 

 

saki
Follow me:
Latest posts by saki (see all)

3 Responses

  1. Bah! That’s not what it should read 🙂

    Since I don’t want to spam comments trying to figure out how to escape the quotes, I’ll just leave you with the instruction to add a quote after the format without explicit example.

    Please feel free to remove these two comments, once it’s fixed, Saki.

  2. For everybody that can’t figure it out on their own, the closing quotation mark after the format is missing – it should read:

    stat -c

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Enter your username and password to log into your account. Don't have an account? Sign up.

Want to collaborate on an upcoming project?