When using GNU stat
to probe the filesystem, there are a number of format sequences available for the --format
/--printf
arguments; this one in particular
%f Raw mode in hex
doesn't make much sense. Comparing with %a, access mode, something might have (you can see this with stat --format '%f %a'
) a raw mode of 41ed but an access mode of 755, or a raw mode of 81a4 and an access mode of 644.
So what does "raw mode" mean?
Best Answer
There are two parts in deciphering what the "raw mode in hex" means; the first is that it's in hex, but access modes are generally described in octal:
If you were to look at
/tmp
, which typically has the restricted deletion flag ('sticky bit') set:and converting:
The "raw mode in hex" is described in the programmer's manual for the stat function (
man 2 stat
), noting that they are octal values:(Strangely, the online man page is missing this section.)
This is a bit field, and we can see that the last four digits match the access mode; the leading digit (in hex) matches the file type, so a hex mode of 81a4 corresponds to "directory, mode 0644", and a hex mode of 41ed corresponds to "regular file, mode 0775".