# In previous, we have learned how permission bits are represented # in 2 related but slightly different ‘human readable’ formats. At # the machine level, though, those bits are simply a 9-bit number # (or rather, 9 bits out of a 16 bit number). Since the 9 bits are # grouped into 3 groups of 3 bits each, it is convenient to # represent them in octal, where each digit corresponds to 3 bits. # Let's first look at the bits that represent various human-readable # triplets: # # • ‹rwx› → ‹111› # • ‹rw-› → ‹110› # • ‹r-x› → ‹101› # • ‹-wx› → ‹011› # # ... and so on ... # # The octal digits correspond to 3-bit binary numbers as follows: # # • ‹0› → ‹000› # • ‹1› → ‹001› # • ‹2› → ‹010› # • ‹3› → ‹011› # • ‹4› → ‹100› # • ‹5› → ‹101› # • ‹6› → ‹110› # • ‹7› → ‹111› # # The digits are written in the same order as with the human # readable form: owner, group and others, from the left. Hence: touch file.txt printf "755: " chmod 755 file.txt ls -l file.txt printf "750: " chmod 750 file.txt ls -l file.txt printf "644: " chmod 644 file.txt ls -l file.txt # Let's have a quick look at how directory permissions work now: # ‹dir.sh›.