Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there a way to get files/directories permissions in number format "0777" instead of "-rw--r--r" format?

share|improve this question

1 Answer

up vote 9 down vote accepted

You can display the octal permissions for a file using the stat command:

stat -c %a [filename]

Or by using find:

find [path] -printf '%m %p\n'

Note that find is recursive, and will print all files in all subdirectories as well. You can use options like maxdepth or prune to stop it from recursing.

share|improve this answer
Awesome, thanks! – amosrivera Mar 8 '11 at 17:31

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.