Skip to Main Content

Infrastructure Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Command to find permission in octal value

807559Feb 12 2009 — edited Mar 4 2009
Hi All,

Is there a way to find out the permission of a file in octal value. ls -l will give in rwx format. But I need this in octal format like 655. To explain the use case,
When i start a script I need to get the permission of file and store it in a variable. Will change the permission of the file during the script execution. The last command in the script should revert back the permission of the file. I am using chmod for doing the same. When I google, I saw a command like stat, but this seems to be C module. Is there any way to do the same using standard commands.

Thanks In Advance,
Veerabahu
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 1 2009
Added on Feb 12 2009
3 comments
255 views