Kolam Ayer MakersLinux Foundations

Number Bases: Decimal, Hexadecimal, Octal

Core Idea

Computers store bits. Humans write numbers in different bases to make those bits readable. Decimal is base 10. Hexadecimal is base 16. Octal is base 8.

Why Linux Uses These Bases

Commands To Try

printf 'A' | xxd
printf '%d\n' 0x41
stat -c '%a %n' ~/playground 2>/dev/null || true

0x41 is hexadecimal for decimal 65, which is the ASCII byte for A. Permission mode 755 is octal: owner can read, write, execute; group and others can read and execute.

Permission Octal

read    = 4
write   = 2
execute = 1

Add them per permission triplet:

7 = 4 + 2 + 1 = rwx
6 = 4 + 2     = rw-
5 = 4     + 1 = r-x
4 = 4         = r--

Common Confusions

Proof Check

Explain why chmod 755 script.sh gives the owner write permission but chmod 555 script.sh does not.

Docs Pointers