Last active
September 3, 2025 11:35
-
-
Save birkin/cf704ef2607c3cc05a93ab7ecc3a1afb to your computer and use it in GitHub Desktop.
bash script to print out a bunch of server info.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Usage: | |
| # bash ./RH_server_specs.sh | tee "$HOME/rh_server_specs_$(hostname -s)_$(date +%Y%m%dT%H%M%S%z).txt" | |
| set -euo pipefail | |
| section(){ printf '\n==== %s ====\n' "$1"; } | |
| section "OS / KERNEL" | |
| cat /etc/redhat-release 2>/dev/null || true | |
| cat /etc/os-release 2>/dev/null || true | |
| uname -srv | |
| section "CPU" | |
| lscpu | |
| echo | |
| echo "First CPU model line:" | |
| grep -m1 'model name' /proc/cpuinfo || true | |
| echo | |
| echo "Core/Thread counts and AVX flags:" | |
| nproc --all | |
| lscpu | grep -i -E 'Flags|Model name|Architecture|CPU\(s\)|Thread|Core|Socket' | |
| section "RAM / SWAP" | |
| free -h | |
| grep -E 'MemTotal|MemAvailable|SwapTotal|SwapFree' /proc/meminfo | |
| section "GPU / DISPLAY CONTROLLERS" | |
| lspci | grep -i -E 'vga|3d|display' || true | |
| if command -v nvidia-smi >/dev/null; then | |
| echo; echo "-- nvidia-smi --" | |
| nvidia-smi --query-gpu=name,memory.total,driver_version,pci.bus_id --format=csv | |
| fi | |
| if command -v rocm-smi >/dev/null; then | |
| echo; echo "-- rocm-smi --" | |
| rocm-smi --showproductname --showdriverversion --showmeminfo vram | |
| fi | |
| for d in /sys/class/drm/card*/device/mem_info_vram_total; do | |
| [ -r "$d" ] && echo "VRAM(bytes): $(cat "$d") (from $d)" | |
| done || true | |
| section "DISKS / FILESYSTEMS" | |
| echo "-- root mount --" | |
| findmnt -n -o TARGET,SOURCE,FSTYPE,OPTIONS / | |
| echo; echo "-- df (human, with fs type) --" | |
| df -hT -x tmpfs -x devtmpfs | |
| echo; echo "-- block devices --" | |
| lsblk -o NAME,TYPE,SIZE,FSTYPE,MOUNTPOINT,MODEL | |
| echo; echo "-- fstab --" | |
| cat /etc/fstab | |
| section "TOOLCHAIN / RUNTIME" | |
| ldd --version | head -n1 | |
| gcc --version 2>/dev/null | head -n1 || true | |
| python3 --version 2>/dev/null || true | |
| pip3 --version 2>/dev/null || true | |
| section "VIRTUALIZATION" | |
| systemd-detect-virt | |
| command -v virt-what >/dev/null && virt-what || true | |
| section "NETWORK" | |
| hostname | |
| hostname -I 2>/dev/null || true | |
| ip -br addr || true | |
| section "CONTAINERS (optional but handy)" | |
| (docker --version 2>/dev/null || true) && (docker info 2>/dev/null | sed -n '1,25p' || true) | |
| (podman --version 2>/dev/null || true) | |
| ## end of RH_server_specs.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment