Skip to content
DevOps devops linux-admin 5 min read

Inspecting System Info

When you log into a server for the first time, you usually know almost nothing about it. What version of Linux is it running? How many CPU cores does it have? How much memory? What is its hostname (the name that identifies the machine on a network)? Before you install anything or debug a problem, you need a quick “inventory” of the box. This page walks through the handful of commands every DevOps engineer runs in the first minute on an unfamiliar Ubuntu server.

Why this matters

Knowing your system details is not just trivia. The OS version tells you which packages and security patches are available. The number of CPU cores and amount of RAM (Random Access Memory — the fast, temporary memory your programs run in) tell you how much load the server can handle and how to size your application. The kernel version (the kernel is the core part of Linux that talks to the hardware) tells you whether a feature or driver is supported. Getting these facts first saves you from guessing later.

Tip: Run these inspection commands before you start installing software. If a deploy goes wrong, the first question your teammates will ask is “what OS and version is it?” Have the answer ready.

uname — kernel and architecture

uname (“Unix name”) prints low-level facts about the kernel and CPU architecture. The most common form is uname -a (the -a flag means “all”).

uname -a

Output:

Linux web-01 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Mon Aug 19 12:00:00 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Reading that line left to right: Linux is the kernel name, web-01 is the hostname, 6.8.0-45-generic is the kernel version, then the build date, and x86_64 is the CPU architecture (64-bit Intel/AMD). On a Raspberry Pi or AWS Graviton server you would see aarch64 instead, which matters because some software ships separate builds per architecture.

Useful single-fact flags:

CommandPrints
uname -rKernel release, e.g. 6.8.0-45-generic
uname -mMachine architecture, e.g. x86_64
uname -nNetwork hostname
uname -sKernel name (Linux)

When to use this: anytime you need the kernel version (for example, to check if a kernel module or container feature is supported) or the architecture (before downloading a binary). When not to: uname does not tell you the Ubuntu release name or number — for that, use lsb_release below.

lsb_release — the Ubuntu version

lsb_release reports the Linux distribution (the specific flavour of Linux, like Ubuntu or Debian) and its version. LSB stands for “Linux Standard Base.”

lsb_release -a

Output:

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 24.04.1 LTS
Release:	24.04
Codename:	noble

Here the server runs Ubuntu 24.04 LTS, codename “noble.” LTS means “Long Term Support” — these releases get security updates for years, so they are the ones you should run in production.

If lsb_release is missing on a minimal install, the same facts live in a plain file you can always read:

cat /etc/os-release

Output:

PRETTY_NAME="Ubuntu 24.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION_CODENAME=noble
ID=ubuntu

When to use this: to confirm the exact Ubuntu version before adding a package repository or following version-specific instructions. The codename (noble, jammy) is what apt repository URLs use.

hostnamectl — identity and a quick summary

hostnamectl is part of systemd (the system and service manager that boots Ubuntu and runs background services). With no arguments it prints a tidy summary that combines several facts in one place.

hostnamectl

Output:

 Static hostname: web-01
       Icon name: computer-vm
         Chassis: vm
      Machine ID: 9f1c3a2b4d5e6f708192a3b4c5d6e7f8
         Boot ID: a1b2c3d4e5f60718293a4b5c6d7e8f90
  Operating System: Ubuntu 24.04.1 LTS
            Kernel: Linux 6.8.0-45-generic
      Architecture: x86-64

To rename the machine permanently (it survives reboots):

sudo hostnamectl set-hostname app-server-02

There is no output on success — run hostnamectl again to confirm. This is the modern, correct way to change a hostname on Ubuntu; editing /etc/hostname by hand is the older approach and can leave systemd out of sync.

Gotcha: After changing the hostname, also update /etc/hosts so the new name still resolves to 127.0.1.1. If you skip this, some tools (like sudo) may pause for a few seconds while they fail to look up the old name.

nproc and lscpu — how many CPUs

nproc answers one question fast: how many CPU cores can this machine use right now?

nproc

Output:

4

For full detail, lscpu (“list CPU”) shows the model, core count, cache sizes, and virtualization info.

lscpu

Output:

Architecture:            x86_64
CPU(s):                  4
Vendor ID:               GenuineIntel
Model name:              Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
Thread(s) per core:      2
Core(s) per socket:      2
Virtualization:          VT-x
Hypervisor vendor:       KVM

When to use this: nproc when a tool needs a thread count (for example make -j$(nproc) to compile using every core). lscpu when you want the CPU model or to confirm a server is virtual (the Hypervisor vendor line tells you it is a VM).

free — memory and swap

free shows RAM and swap usage. Swap is disk space the system uses as overflow when RAM fills up — slower than RAM, but it prevents crashes. Always add -h (“human-readable”) so sizes show as MB/GB instead of raw bytes.

free -h

Output:

               total        used        free      shared  buff/cache   available
Mem:           7.8Gi       1.2Gi       4.1Gi        12Mi       2.5Gi       6.3Gi
Swap:          2.0Gi          0B       2.0Gi

The column that matters most is available — that is roughly how much memory you can still give to new programs (it counts cache that Linux will release on demand). If available is near zero and Swap used is climbing, the server is running short on memory.

A one-line inventory

Chain the essentials into a single block you can paste into any fresh server:

echo "== OS ==" && lsb_release -d && \
echo "== Kernel ==" && uname -r && \
echo "== CPU ==" && nproc && \
echo "== Memory ==" && free -h | grep Mem

Output:

== OS ==
Description:	Ubuntu 24.04.1 LTS
== Kernel ==
6.8.0-45-generic
== CPU ==
4
== Memory ==
Mem:           7.8Gi       1.2Gi       4.1Gi        12Mi       2.5Gi       6.3Gi

Best Practices

  • Run hostnamectl first — it gives you OS, kernel, and architecture in one screen.
  • Always prefer LTS releases of Ubuntu in production for the long security-support window.
  • Use free -h and df -h together to check both memory and disk before deploying anything heavy.
  • After hostnamectl set-hostname, update /etc/hosts to match so name lookups stay fast.
  • Quote and save your one-line inventory in a team runbook so everyone gathers the same facts the same way.
  • Read /etc/os-release instead of lsb_release in scripts — it is always present, even on minimal images.
Last updated June 15, 2026
Was this helpful?