How do I identify a server’s Linux distribution, kernel and CPU architecture?
Read the operating-system release file for the distribution and use uname for the running kernel and architecture. These describe different layers: an updated operating-system package set can coexist with an older running kernel until a planned reboot. Architecture also determines which application binaries are compatible.
Before you start
- An authorised SSH session on the Linux server.
Instructions
1. Read the distribution identity
Inspect the declared release without executing its contents as a shell script. Record the version as well as the distribution family before following a package-management guide.
cat /etc/os-releaseLook for ID, VERSION_ID and PRETTY_NAME. On images without this path, consult the image vendor’s supported release-identification method.
2. Read the active kernel and architecture
These commands describe the currently running environment. Containers may report their host’s kernel, and a virtual machine exposes the architecture and CPU features presented by its hypervisor.
uname -r
uname -m-r reports the running kernel release; -m reports the machine architecture, such as x86_64 or aarch64.
Check the result
- The distribution, release and architecture match the requirements of the commands or packages you intend to use. Use release-specific support documentation for update policy.
Troubleshooting
- A binary reports Exec format error
- Check its architecture and supported platform; changing execute permissions will not make an incompatible binary work.
- The kernel version differs from an installed package
- Installed and running kernels are separate states. Investigate the booted version before planning a reboot.
Official references
Use the documentation for your installed version when a flag, service name or platform feature differs.
