Check Linux system information with uname, hostnamectl and neofetch

Beginner 15 min Nov 21, 2026 11 views
Ubuntu 24.04 Ubuntu 22.04 Debian 12 Debian 11 AlmaLinux 9 Rocky Linux 9 Fedora 41

Learn how to check your Linux kernel version, OS release, CPU, memory and hardware details using uname, hostnamectl, neofetch and lscpu. Includes a scriptable system info report for documentation.

Prerequisites

  • A Linux server or VM with terminal access
  • sudo or root privileges
  • Internet access to install packages

What this solves

When you log into a new server or troubleshoot an issue, the first question is always the same: what am I actually running. This tutorial covers the standard commands for checking kernel version, OS release, CPU, memory and uptime on any modern Linux distribution.

You will use uname and hostnamectl for quick facts, neofetch or fastfetch for a visual summary, and lscpu plus free for hardware details. At the end you will have a reusable script that prints a full system report for documentation or support tickets.

Step-by-step configuration

Check kernel version and architecture with uname

uname is available on every Linux system by default and reports kernel name, version, and CPU architecture without needing any extra packages.

uname -a

For just the kernel release version, which is useful when checking if a kernel update applied:

uname -r

To confirm the CPU architecture, which matters when downloading binaries or Docker images:

uname -m

A typical output is x86_64 for 64-bit Intel/AMD systems or aarch64 for ARM servers.

View OS release details with hostnamectl

hostnamectl, part of systemd, shows the hostname, OS name, kernel version, and virtualization type in one command on any systemd-based distro.

hostnamectl

Sample output looks like this:

Static hostname: web01
Icon name: computer-vm
Chassis: vm
Machine ID: 8f3a2b1c9d4e4f5a8b6c7d9e0f1a2b3c
Boot ID: 1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d
Virtualization: kvm
Operating System: Ubuntu 24.04.1 LTS
Kernel: Linux 6.8.0-45-generic
Architecture: x86-64

Read /etc/os-release for scripting-friendly values

The /etc/os-release file provides machine-readable variables that scripts and configuration management tools rely on to detect distro and version.

cat /etc/os-release

To grab just the pretty name in a script:

source /etc/os-release
echo "$PRETTY_NAME"
Note: Always parse /etc/os-release instead of scraping uname -a output in scripts. It has stable, documented field names like ID, VERSION_ID and PRETTY_NAME.

Install neofetch or fastfetch for a visual summary

neofetch prints a colorful system summary next to your distro logo. It has been deprecated upstream, so on newer releases fastfetch is the maintained alternative with the same output style.

sudo apt update
sudo apt install -y fastfetch

If your repo still carries neofetch (Ubuntu 22.04 and Debian 11/12):

sudo apt install -y neofetch
sudo dnf install -y epel-release
sudo dnf install -y neofetch

On Fedora 41, fastfetch is in the default repos:

sudo dnf install -y fastfetch

Run it with:

fastfetch

Or if you installed neofetch:

neofetch

Check CPU details with lscpu

lscpu reads from sysfs and /proc/cpuinfo to show core count, socket count, model name, and virtualization support.

lscpu

To check specifically how many cores are available for capacity planning:

nproc

Check memory usage with free

free shows total, used, and available RAM along with swap usage. The -h flag makes values human-readable.

free -h

If you need deeper memory and hardware details including DIMM slots and disk controllers, lshw provides a full hardware inventory.

sudo apt install -y lshw
sudo lshw -short
sudo dnf install -y lshw
sudo lshw -short

Find system uptime and boot time

The uptime command shows how long the system has been running along with load averages, which is useful when correlating issues with a recent reboot.

uptime -p

To find the exact date and time the system last booted:

who -b

Or with systemd, which also shows firmware and kernel boot time separately:

systemd-analyze

Script a quick system info report

For documentation or support tickets, combine these commands into one script that outputs a consistent report. Save it somewhere in your path, like /usr/local/bin/sysreport.

#!/bin/bash
set -euo pipefail

echo "=== System report: $(date) ==="
echo
echo "--- Hostname and OS ---"
hostnamectl | grep -E 'Static hostname|Operating System|Kernel|Architecture|Virtualization'
echo
echo "--- CPU ---"
lscpu | grep -E '^Model name|^CPU\(s\)|^Socket|^Thread'
echo
echo "--- Memory ---"
free -h
echo
echo "--- Disk usage ---"
df -h --output=source,size,used,avail,pcent,target -x tmpfs -x devtmpfs
echo
echo "--- Uptime ---"
uptime -p
echo
echo "--- Network interfaces ---"
ip -brief addr show

Make the script executable, owned by your user, with permissions that allow execution without granting write access to everyone.

sudo chmod 755 /usr/local/bin/sysreport
sudo chown root:root /usr/local/bin/sysreport
Never use chmod 777. It gives every user on the system full read, write and execute access to the script, including the ability to modify it. Use 755 so only the owner can edit it while everyone can run it.

Run the report and optionally save it to a file for a support ticket:

sysreport | tee ~/system-report-$(date +%Y%m%d).txt

Verify your setup

Confirm each tool reports consistent information by cross-checking kernel version and OS release.

uname -r
hostnamectl | grep Kernel
grep PRETTY_NAME /etc/os-release
fastfetch --version 2>/dev/null || neofetch --version

If you built the report script, confirm it runs cleanly end to end:

sysreport

Common issues

SymptomCauseFix
neofetch: command not found after installPackage not in default repos on newer distro versionsInstall fastfetch instead, it is the maintained fork with the same syntax
hostnamectl shows wrong OS name after upgradeStale cache in systemd-hostnamedRun sudo systemctl restart systemd-hostnamed then check again
lscpu output missing virtualization lineRunning inside a container without access to CPU flagsExpected behavior in containers, check the host instead with uname -a
Permission denied running /usr/local/bin/sysreportExecute bit not set on the scriptRun sudo chmod 755 /usr/local/bin/sysreport, never chmod 777
free -h shows unexpectedly low available memoryPage cache counted separately from free memoryCheck the available column, not free, since Linux uses spare RAM for disk cache

Next steps

Running this in production?

Want this handled for you? This works for a single server. When you run multiple environments or need this available 24/7, keeping it healthy is a different job. See how we run infrastructure like this for European teams.

Automated install script

Run this to automate the entire setup

#linux basics #uname #hostnamectl #neofetch #system information #sysadmin tools #lscpu

Don't want to manage this yourself?

We handle infrastructure for businesses that depend on uptime. Fully managed, with one fixed contact who knows your setup.

You get one fixed contact who knows your setup

Rotterdam 11:48 · reachable in a message, no ticket form

Learn more: managed cloud infrastructure