uname Command Reference: Flags, Usage & CI Examples
uname prints system information like OS, kernel, and architecture.
uname reports the operating system, kernel version, and machine architecture. In CI it drives portable scripts that download the right binary for the host OS and CPU.
Common flags and usage
- -s: kernel/OS name (Linux, Darwin)
- -m: machine hardware name (x86_64, aarch64, arm64)
- -r: kernel release
- -a: all available information
- -o: operating system (GNU/Linux)
Example
shell
OS=$(uname -s)
ARCH=$(uname -m)
echo "downloading tool for ${OS}/${ARCH}"In CI
uname -s and -m let one script pick the correct release asset across Linux and macOS runners and across x86_64 and arm64. Note the naming differs (Linux reports aarch64 where macOS reports arm64), so normalize before matching a download URL.
Key takeaways
- uname reports OS, kernel, and CPU architecture.
- -s and -m drive portable per-platform downloads.
- Arch names differ (aarch64 vs arm64); normalize them.
Related guides
getent Command Reference: Databases, Usage & CI ExamplesReference for getent: hosts, passwd, group, the NSS-aware lookup advantage, and a CI example that resolves a…
which Command Reference: Usage & CI ExamplesReference for which: locating an executable in PATH, the command -v alternative, and a CI example that assert…
ulimit Command Reference: Flags, Usage & CI ExamplesReference for ulimit: -n, -u, -a, soft vs hard limits, the too-many-open-files fix, and a CI example that rai…