Command to find permission in octal value
807559Feb 12 2009 — edited Mar 4 2009Hi 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