Linux System Report
This report only runs on Linux systems.
System Information
import platform
import os
print(f"System: {platform.system()}")
print(f"Release: {platform.release()}")
print(f"Version: {platform.version()}")
print(f"Machine: {platform.machine()}")
print(f"Processor: {platform.processor()}")
System: Linux
Release: 6.11.0-1018-azure
Version: #18~24.04.1-Ubuntu SMP Sat Jun 28 04:46:03 UTC 2025
Machine: x86_64
Processor: x86_64
Linux-Specific Info
import subprocess
# Get distribution info
try:
with open("/etc/os-release") as f:
print("Distribution Info:")
for line in f:
if line.startswith(("NAME=", "VERSION=", "ID=", "PRETTY_NAME=")):
print(f" {line.strip()}")
except FileNotFoundError:
print("Could not read /etc/os-release")
# Get kernel info
result = subprocess.run(["uname", "-a"], capture_output=True, text=True)
print(f"\nKernel: {result.stdout.strip()}")
Distribution Info:
PRETTY_NAME="Ubuntu 24.04.3 LTS"
NAME="Ubuntu"
VERSION="24.04.3 LTS (Noble Numbat)"
ID=ubuntu
Kernel: Linux runnervm6qbrg 6.11.0-1018-azure #18~24.04.1-Ubuntu SMP Sat Jun 28 04:46:03 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Memory Info
with open("/proc/meminfo") as f:
lines = f.readlines()[:5]
print("Memory Info:")
for line in lines:
print(f" {line.strip()}")
Memory Info:
MemTotal: 16379472 kB
MemFree: 8840064 kB
MemAvailable: 15349224 kB
Buffers: 68424 kB
Cached: 6593836 kB
Disk Usage
import shutil
total, used, free = shutil.disk_usage("/")
print(f"Total: {total // (1024**3)} GB")
print(f"Used: {used // (1024**3)} GB")
print(f"Free: {free // (1024**3)} GB")
print(f"Usage: {used / total * 100:.1f}%")
Total: 71 GB
Used: 54 GB
Free: 17 GB
Usage: 75.5%