Skip to content
Français
Sync not enabled: your progress stays in this browser My learning
Select theme
Français

Identify your Linux system

By updated

Improve this page

You land on an unknown Linux machine and need to find your bearings. Which distribution? Which kernel version, the core program that drives the hardware? How long has it been running? Any failed services? Which processor (CPU), how much memory (RAM)? This guide lines up the modern commands that answer these questions in a few minutes.

Many of these commands come from systemd, the program that starts the machine and supervises its services. A service is a program that runs in the background, such as a web server or a client that sets the clock. Everything systemd manages, whether a service, a disk mount or a timer, is called a unit. These tools replace the old lsb_release command, which is no longer installed everywhere.

Command availability was checked on 1 October 2026 on Debian 13, Ubuntu 24.04 and AlmaLinux 10.2, as were the outputs of os-release and needs-restarting. The other examples come from an older capture on Ubuntu 24.04, where only the version numbers differ. Ubuntu 26.04 LTS, the course's reference version, has not been measured yet for this page: the two points concerned (lsb_release and last) are flagged in the text.

What you will learn

  • Identify the distribution and its version with os-release and hostnamectl
  • Read the kernel, the architecture and the host name
  • Measure the uptime and interpret the load average
  • Check the overall systemd state and the failed services
  • Take a basic hardware inventory (CPU, memory, disks, PCI, USB)
  • Analyse the last startup (boot) with journalctl and systemd-analyze

In which context?

Three concrete scenarios:

  • You take over an existing server that you did not install: your first reflex is to take stock.
  • An incident occurs, for example a slow service or a reboot that went wrong: before looking for the cause, you must know which machine you are working on.
  • You audit a fleet of machines running various distributions, and you write a script that collects, for each one, the distribution, the kernel version and the running time (uptime).

These gestures fall under the LFCS (Linux Foundation, Essential Commands section) and RHCSA (Red Hat, Understand and use essential tools section) certifications.

Prerequisites

  • A shell with user rights (most commands do not need sudo)
  • A system running systemd (Ubuntu 16.04+, Debian 8+, RHEL 7+, Rocky, Fedora), for the hostnamectl, timedatectl and systemctl commands. The hostnamectl hostname verb needs a recent systemd (the systemd 249 manual documents it, the 246 one only knows set-hostname)
  • The util-linux tools (installed by default everywhere) for lscpu and lsblk

Identify the distribution

A distribution is a version of Linux ready to install, such as Ubuntu, Debian or AlmaLinux. Knowing which one runs on a machine conditions everything else: the package manager to use (the tool that installs software, such as apt or dnf), the exact service names and the documentation to open. Three sources answer the question, and they are not equal: a standardised file present everywhere, a systemd command that tells you more, and a leftover that is no longer installed everywhere. Take them in that order.

/etc/os-release, the modern canonical source

This file exists on every systemd distribution. It is standardised: a human reads it with no effort, and a script easily extracts each field.

Terminal window
cat /etc/os-release

Output recorded on Ubuntu 24.04 (excerpt):

PRETTY_NAME="Ubuntu 24.04.5 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.5 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian

On AlmaLinux 10.2, from the RHEL family (Rocky Linux likewise shows ID="rocky"):

NAME="AlmaLinux"
VERSION="10.2 (Lavender Lion)"
ID="almalinux"
ID_LIKE="rhel centos fedora"
VERSION_ID="10.2"

The ID, VERSION_ID and ID_LIKE fields are what scripts use to write code that branches by distribution.

hostnamectl, the systemd view

hostnamectl gives a broader summary: distribution, kernel, architecture, virtualisation and host, all in one command:

Terminal window
hostnamectl
Static hostname: master2
Icon name: computer-vm
Chassis: vm
Machine ID: e84a5b...
Boot ID: 3f21a0...
Virtualization: kvm
Operating System: Ubuntu 24.04.2 LTS
Kernel: Linux 6.8.0-58-generic
Architecture: x86-64

The versions in this output (Ubuntu 24.04.2, kernel 6.8.0-58) come from an older capture than the os-release one above (24.04.5). On your machine, the numbers will be different.

The Virtualization line of this output deserves particular attention: hostnamectl detects on its own whether it runs in a virtual machine (KVM, QEMU, VMware), in a container (Docker, LXC) or at a cloud provider; on a physical machine, the line is absent. A virtual machine is a machine simulated by software; a container is a group of isolated processes that share the kernel of the machine hosting them. It is often the first thing to establish on an unknown server, because it decides what is possible: you do not change a kernel parameter or a hardware setting from inside a container.

lsb_release, the legacy

Historically the reference command, lsb_release is no longer present everywhere, and that is what rules it out in a script. Ubuntu 24.04 still installs it. On Debian 13, it is missing from a standard installation, and on RHEL 10 no package provides it any more. This measurement holds for Ubuntu 24.04: it remains to be done on Ubuntu 26.04, and nothing allows assuming the same result. A script that works on Ubuntu therefore fails elsewhere:

Terminal window
lsb_release -a # may return "command not found"

Replace it with cat /etc/os-release wherever you come across it.

Identify the host

The host name is read with hostname, and its options are easy to mix up: -A lists the fully qualified names (FQDN, the host name followed by its domain), -I the IP addresses, as the command's own help confirms:

Terminal window
hostname # short name
hostname -f # FQDN (Fully Qualified Domain Name)
hostname -A # all the machine's FQDNs
hostname -I # all the machine's IP addresses

Change the host name persistently (systemd):

Terminal window
sudo hostnamectl hostname admin-prod-01

The hostname verb reads the name when you give it no argument and changes it when you give one. This is the form described by man hostnamectl in recent systemd releases (257 on Debian 13 and AlmaLinux 10). The older hostnamectl set-hostname form no longer appears in the help or the manual, but the binary still recognises it: you will meet it in many tutorials and scripts.

By default the command changes all three names at once (static, pretty and transient). Three options target only one:

Terminal window
sudo hostnamectl hostname admin-prod-01 --static # permanent name, the one in /etc/hostname
sudo hostnamectl hostname "Admin workstation Stephane" --pretty # human label
sudo hostnamectl hostname admin-prod-01 --transient # ephemeral, reset at reboot

Identify the kernel and the architecture

The uname command exposes everything you need in a single line:

Terminal window
uname -a
Linux master2 6.8.0-58-generic #60-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 14 18:29:48 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Targeted options:

OptionWhat it showsUse case
-rKernel version (6.8.0-58-generic)Check whether a reboot is needed after an upgrade
-mArchitecture (x86_64, aarch64)Pick the right Docker image, the right binary
-nShort host nameAlternative to hostname
-vKernel build dateCheck how old the installed kernel is

The arch command (which shows only the equivalent of uname -m) still exists but adds nothing; prefer uname -m.

To check whether a reboot is needed after a kernel update, each family has its own tool:

Terminal window
# File created by the update-notifier-common package when a reboot is required
test -f /var/run/reboot-required && echo "Reboot required" || echo "OK"

Uptime and load

uptime gives in one line the machine's running time and its load:

Terminal window
uptime
18:29:45 up 5 days, 2:15, 1 user, load average: 0.00, 0.01, 0.05

The line shows the current time, the uptime (the time since the last startup), the number of connected users and the load average over 1, 5 and 15 minutes. The first three pieces of information are read at a glance: how long the machine has been running, and how many users are connected. The load average, which tells whether the machine is struggling, is less intuitive. The two subsections below explain it, then give the command variants that help when the full line is not enough.

Interpret the load average

The load average gives the average number of processes that are running (state R) or waiting for a CPU or for a resource such as the disk (input/output, or I/O). Divide it by the number of cores (nproc) to get a ratio:

Terminal window
nproc
uptime

nproc prints the number of cores, for example 4. In the uptime line, take the first of the three load average numbers (the load over 1 minute) and divide it by that number of cores. A load of 2.0 on a 4-core machine gives a ratio of 0.5.

Ratio load / nprocInterpretation
< 0.7Comfortable margin
0.7 – 1.0Busy but fine
> 1.0 sustainedSaturation, processes are queueing

These thresholds of 0.7 and 1.0 are a rule of thumb, not a limit set by the kernel: they help spot a machine worth examining, not declare it broken. Also keep in mind that Linux counts processes waiting for the disk in the load. A high load with an idle processor can therefore come from a slow disk, not from a lack of CPU.

To read the load more finely, see Check the system load. For a full diagnosis of the machine, Assess system performance details the USE method (utilisation, saturation, errors).

Useful variants

When only the running time matters to you, two uptime options save you from reading the whole line. -p gives a readable sentence, -s gives the exact timestamp of the last boot, handy for matching an incident with the time of a reboot.

Terminal window
uptime -p # human format: "up 5 days, 2 hours"
uptime -s # exact boot date: "2026-04-20 16:14:30"

Overall systemd state

One command tells you whether the machine is healthy. It answers with a single word, among eight states:

Terminal window
systemctl is-system-running
OutputMeaning
runningAll good
degradedAt least one failed unit
initializingEarly startup, before basic.target is reached
startingLate startup, before the job queue is empty for the first time
stoppingShutdown in progress
maintenanceRescue mode active
offlinesystemd is not running as the system manager
unknownState impossible to determine

Only running returns exit code 0; the other seven states return a non-zero code, which lets you test the state in a script.

When it says degraded, list the culprits:

Terminal window
systemctl list-units --failed

To see who is connected, loginctl lists the open sessions, then the users:

Terminal window
loginctl list-sessions
loginctl list-users

timedatectl shows the date, the time zone and the state of the clock synchronisation:

Terminal window
timedatectl
Local time: Fri 2026-04-25 14:30:12 CEST
Universal time: Fri 2026-04-25 12:30:12 UTC
RTC time: Fri 2026-04-25 12:30:12
Time zone: Europe/Paris (CEST, +0200)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no

NTP (Network Time Protocol) is the protocol through which the machine sets its clock from time servers. The System clock synchronized and NTP service lines are what you check after a reboot to confirm the clock is right. The RTC time line gives the time of the hardware clock, the one that keeps running while the machine is off.

Logs and analysis of the last boot

journalctl reads the systemd journal, that is, the messages (logs) of the machine and its services. It can isolate those of a specific startup:

Terminal window
# logs of the current boot
journalctl -b
# logs of the previous boot
journalctl -b -1
# list of the available boots with their IDs
journalctl --list-boots

systemd-analyze gives the detailed boot time:

Terminal window
# overall view
systemd-analyze
# Startup finished in 3.481s (kernel) + 41.225s (initrd) + 1min 14.060s (userspace) = 1min 58.766s
# top 10 slowest services at boot
systemd-analyze blame | head -10
# boot timeline as SVG: which unit starts when (useful post-mortem)
systemd-analyze plot > boot.svg
# graph of the dependencies between units, to feed to Graphviz (the graphviz package provides the dot command)
systemd-analyze dot | dot -Tsvg > dependencies.svg

Reboot history is read with the last command. It comes from util-linux on Ubuntu 24.04 and AlmaLinux 10. On Debian 13, it comes from the wtmpdb package, of standard priority: it is present on a full installation, but not in a minimal image. Here again, the measurement holds for Ubuntu 24.04 and remains to be done on Ubuntu 26.04:

Terminal window
last reboot | head -5
last -x shutdown | head -5

Quick hardware inventory

Six commands sweep through a machine's hardware in 30 seconds.

CPU, lscpu

Terminal window
lscpu

lscpu describes the processor: architecture, model, number of cores, frequency, cache. It also reports the state of the mitigations, that is, the protections the kernel turns on against hardware flaws in processors, such as Spectre and Meltdown. Each known flaw carries a public identifier called a CVE (for example CVE-2017-5754 for Meltdown). The lines to remember:

  • Architecture: x86_64, aarch64, armv7l…
  • CPU(s): logical total (cores × threads per core)
  • Core(s) per socket, Thread(s) per core: actual topology
  • Model name: exact model
  • Vulnerabilities:: mitigation state per CVE

Memory, free -h

Terminal window
free -h

Detailed in Diagnose memory on Linux. For a first look, the available column is the right metric, not free.

Disks, lsblk

Terminal window
lsblk

lsblk draws the tree of storage devices: disks, partitions, LVM volumes and LUKS encrypted volumes. Two commands complement it:

Terminal window
lsblk -f # with file systems and UUIDs
df -hT # space used per mount point

PCI, lspci

Terminal window
lspci | head -20

lspci lists the network cards, disk controllers, graphics cards (GPUs) and all the hardware on the PCI bus. For the details of one device, give its address, read in the first column:

Terminal window
lspci -v -s 00:1f.6 # verbose mode on the address 00:1f.6

USB, lsusb

Terminal window
lsusb

USB devices currently plugged in. Useful to check that a stick, a card reader or a YubiKey is detected.

Virtualisation, systemd-detect-virt

Terminal window
systemd-detect-virt

Returns kvm, qemu, vmware, docker, lxc, oracle (VirtualBox), or none if the machine is physical. A quick equivalent of the Virtualization field of hostnamectl.

Good practices

These reflexes turn the commands of this guide into a reproducible inventory routine. The principle is to favour the modern systemd tools (hostnamectl, systemctl, timedatectl) and the standardised files (/etc/os-release) over the legacy commands that are no longer installed everywhere. The health check runs at the very start of an intervention, before you change anything, to capture the starting state.

  • hostnamectl first on a systemd system: it gives a summary view in a single command.
  • /etc/os-release in scripts, never lsb_release. It is present everywhere: the . /etc/os-release command (the dot loads the file into the shell) makes the $ID and $VERSION_ID variables available.
  • systemctl is-system-running at the start of each intervention: you see straight away whether a service was already down before you touched anything.
  • After a kernel update, check whether a reboot is required with the tool of your distribution family (see above): uname -r shows the running kernel, which only changes at reboot.
  • timedatectl every time after a reboot or a time zone change: clock synchronised, NTP active.
  • lscpu and free -h in a baseline script produce a flat inventory that is useful for audits.

Quick troubleshooting

The problems you hit while identifying a machine are rarely failures: they are mostly missing commands or an incomplete configuration (FQDN, NTP). Read the table starting from the exact message displayed. One row deserves particular attention: when lscpu reports Vulnerable on some hardware CVEs, it is not a false positive, it is a kernel whose mitigations are not up to date, to be treated as a real hardening gap on an exposed server.

SymptomLikely causeAction
hostnamectl: command not foundSystem without systemd or restricted shellFallback: uname -n + cat /etc/os-release
lsb_release: command not foundPackage not installed (the default on Debian 13, absent from RHEL 10)Do not use it, read /etc/os-release instead
last: command not found on Debian 13last now comes from the wtmpdb packagesudo apt install wtmpdb, or journalctl --list-boots
hostname -f returns nothingFQDN not configured in /etc/hosts or DNSAdd a line with the FQDN to /etc/hosts
uptime shows up 1 min (the duration in minutes under an hour, then up 1:05 beyond) after an unexpected rebootThe machine was restarted (power cut, kernel crash or human action). The OOM killer (Out Of Memory killer, the kernel mechanism that kills a process when memory runs out) does not reboot the machine, unless vm.panic_on_oom is 1 or 2journalctl -b -1 | tail to see the previous boot
systemctl is-system-running returns degradedA service or a disk mount failedsystemctl list-units --failed for the list
timedatectl shows NTP service: inactiveNo active NTP synchronisationsudo systemctl enable --now systemd-timesyncd (systemd's lightweight NTP client), or the chrony service if the package is installed (chrony on Debian and Ubuntu, chronyd on RHEL and AlmaLinux)
lscpu shows Vulnerable on several CVEsKernel mitigations missing or turned offUpdate the kernel and the microcode (the processor's internal software), then look for mitigations=off in /proc/cmdline, the file that lists the options passed to the kernel at startup

Key points

  • /etc/os-release is the canonical source for distribution and version, to prefer over lsb_release everywhere.
  • hostnamectl gives in one command: host, kernel, architecture, virtualisation, OS.
  • hostnamectl hostname <name> renames the machine; with no option, all three names (static, pretty, transient) change. The older set-hostname is still recognised.
  • uname -r, -m and -n read the kernel, the architecture and the short name.
  • hostname -A lists the FQDNs, hostname -I the IP addresses.
  • With uptime, divide the load average by the number of cores (nproc) to interpret it.
  • systemctl is-system-running then systemctl list-units --failed are the pair for checking overall health.
  • timedatectl checks time, time zone and NTP synchronisation in one command.
  • journalctl -b -1 gives the logs of the previous boot, essential after a crash.
  • systemd-analyze blame lists the slowest services at boot.
  • For the hardware inventory: lscpu, free -h, lsblk, lspci, lsusb.

Knowledge check

Check that the essentials of this guide are acquired. The questions only cover what has just been explained here.

Knowledge check

Check what you have learned with this interactive quiz

6 questions
6 min
70% to pass

How it works

  • The timer starts when you click Start
  • Multiple choice, true/false and short answer questions
  • You can move between questions
  • Detailed results are shown at the end

Starts the quiz and the timer