0

I can change the permissions of a file by:

chmod 600 ~/.ssh/authorized_keys

How can I retrieve the permissions of a file in the same format which is 600?

Johshi
  • 453
  • 2
  • 5
  • 14
  • 3
    Related: [Convert ls -l output format to chmod format](http://unix.stackexchange.com/questions/71585/convert-ls-l-output-format-to-chmod-format) – steeldriver Jul 21 '16 at 15:21

1 Answers1

3

stat(1) can show many file associated attributes by specifying special format strings to it's -c option. In your case, use stat -c '%a' ~/.ssh/authorized_keys to receive the same file mode in octal, 600.

See it's manual page for a full list of supported format modifiers.