You can get some pretty confusing information depending on whom you ask. The modes you specify with chmod
, mkdir
, touch
and other tools that create and modify file permissions tend to deal only with the lower-order permission bits, and sometimes the sticky and set[ug]id bits. The higher-order parts of the mode, which ls -l
and stat
output, but are less often seen, include the file type.
The rightmost nine bits are all entirely occupied by permissions, and the next several bits are related to sticky, setuid and segid bits. Note:
bin(0777) => '0b111111111' # 9 bits, all read, write, exec
bin(01777) => '0b1111111111' # 10 bits, sticky + 0777
bin(02777) => '0b10111111111' # 11 bits, setgid + 0777
bin(04777) => '0b100111111111' # 12 bits, setuid + 0777
So that article is a little confusing considering there's no space for the file type to fit within the first 12 bits.
You seem to be clear on this in the question, but for posterity, the leading 0
is what identifies the value as octal. So even if you wanted to specify a file type, you'd certainly have to start with something like 03…
.
In any case, mkdir
is going to make a directory or nothing. It won't make a file, so it's not concerned with the file type bit.