Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

LinuxLinux + IT series

6 numbers every sysadmin should know

Six numbers that keep coming up in Linux and server work. Each one explains a whole category of problems.

Quick reference

NumberWhatWhy it matters
0Exit code for successAnything else means an error. Check it with echo $?.
1PID of the init systemsystemd is process 1. Everything else starts from it.
1024Privileged port limitPorts below 1024 need root, or a capability, to bind.
255Highest exit codeExit codes run from 0 to 255. exit 256 becomes 0.
8.76 hDowntime a year at 99.9%Three nines still allows almost nine hours of outage.
127.0.0.1Loopback addressTraffic that never leaves the machine. Bind internal services here.

Explained

  • 0 — the exit code for success. Every command returns a number when it finishes. Zero means it worked, anything else is an error. echo $? shows the last one, and it is what && and || in scripts and cron monitoring are checking.
  • 1 — the process ID of the init system. On modern Linux that is systemd. It starts every other service and adopts orphaned processes. That is why ps shows PID 1 on every Linux system, and why a container's main process runs as PID 1 inside its own namespace.
  • 1024 — the privileged port limit. Ports below 1024, like 22, 80 and 443, need root or the CAP_NET_BIND_SERVICE capability to bind. This is why web servers start as root and then drop privileges, or sit behind a proxy.
  • 255 — the highest exit code. Exit codes are stored in 8 bits, so they run from 0 to 255. A script that does exit 256 actually returns 0, success. Codes above 128 usually mean the process was killed by a signal: 137 is 128 + 9, SIGKILL, often the OOM killer.
  • 8.76 hours — the downtime per year that 99.9% availability still allows. Three nines sounds strict. It is almost nine hours of outage a year, or about 43 minutes a month.
  • 127.0.0.1 — the loopback address. Traffic to it never leaves the machine. Databases, caches and admin panels that only local apps use should listen here, not on 0.0.0.0.

In one line

Numbers make things concrete. Know these and many error messages explain themselves.

Check the last exit code

echo $?

More notes: Linux

Open in the notes app: search, filters, copy This note on GitHub