uname -a: Identify Kernel and Architecture in CI
uname -a prints the kernel name, release, and machine architecture, the quickest way to confirm whether a runner is x86_64 or aarch64.
Cross-architecture surprises (an arm64 runner running an x86_64 image, or vice versa) cause exec-format errors. uname -m settles the architecture question in one line.
What it does
uname reports system identification. -m gives the hardware architecture (x86_64, aarch64, armv7l), -r the kernel release, -s the kernel name, and -a all of it. It describes the running kernel and CPU arch, which is what matters for binary compatibility.
Common usage
uname -a
uname -m # x86_64 or aarch64
uname -r # kernel release, e.g. 6.8.0-45-generic
# branch a build on architecture
case "$(uname -m)" in aarch64) ARCH=arm64;; x86_64) ARCH=amd64;; esacOptions
| Flag | What it does |
|---|---|
| -a | All fields |
| -m | Machine hardware (architecture) |
| -r | Kernel release |
| -s | Kernel name (e.g. Linux) |
| -n | Network node hostname |
In CI
When a downloaded binary fails with "cannot execute binary file: Exec format error", the architecture is wrong; uname -m tells you which release artifact to fetch (amd64 vs arm64). On Apple-silicon or Graviton runners, uname -m returns aarch64, and tooling that hardcodes x86_64 download URLs will pull an incompatible binary.
Common errors in CI
Confusing "exec format error" for a corrupt download: it is almost always an architecture mismatch that uname -m would have caught. Note uname reports the kernel/arch, not the distro: use cat /etc/os-release for the distribution name and version, which uname does not provide.