Skip to content
zemationPublic

About

A lightweight system information CLI tool written in Go. No external dependencies.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

29 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

sysinfo

A lightweight, cross-platform system information CLI tool written in Go. Minimal external dependencies β€” reads directly from Linux virtual filesystems, macOS system utilities/syscalls, and Windows Win32 APIs.

Example Output

Host:    host.example.com
IP:      192.168.0.10
OS:      Rocky Linux 10.1 (Red Quartz)
Kernel:  6.12.0-124.56.1.el10_1.x86_64
Arch:    amd64
CPU:     AMD Ryzen 7 3700X 8-Core Processor (16 cores)
Memory:  5.4 GB / 31.0 GB
Disk:    41.0 GB / 69.9 GB
Uptime:  10 days, 20 hours, 28 minutes
Load:    0.08, 0.13, 0.12 (1, 5, 15 min)
GPU:     NVIDIA GeForce RTX 3080

Requirements

  • Go 1.22 or higher (when building from source)
  • Linux, macOS, or Windows

Download

Pre-built binaries are available on the Releases page.

Binary OS Architecture
sysinfo-linux-amd64 Linux x86_64 (64-bit)
sysinfo-linux-arm64 Linux ARM64 (Raspberry Pi, etc)
sysinfo-darwin-amd64 macOS Intel (x86_64)
sysinfo-darwin-arm64 macOS Apple Silicon (M1/M2/M3/M4)
sysinfo-windows-amd64.exe Windows x86_64 (64-bit)
sysinfo-windows-arm64.exe Windows ARM64

Install with Go (All Platforms)

go install github.com/zemation/sysinfo@latest

Install from release (Linux / macOS)

# Download the binary for your OS and architecture (e.g., linux-amd64 or darwin-arm64)
curl -LO https://github.com/zemation/sysinfo/releases/latest/download/sysinfo-linux-amd64

# Make it executable
chmod +x sysinfo-linux-amd64

# Install system-wide
sudo mv sysinfo-linux-amd64 /usr/local/bin/sysinfo

Install from release (Windows PowerShell)

# Download the binary directly into WindowsApps (already on your user PATH)
Invoke-WebRequest -Uri https://github.com/zemation/sysinfo/releases/latest/download/sysinfo-windows-amd64.exe -OutFile "$env:LOCALAPPDATA\Microsoft\WindowsApps\sysinfo.exe"

# Run sysinfo from anywhere
sysinfo

Build from Source

git clone https://github.com/zemation/sysinfo.git
cd sysinfo
go build -o sysinfo main.go

On Windows:

git clone https://github.com/zemation/sysinfo.git
cd sysinfo
go build -o sysinfo.exe main.go

Commands

Command Description
sysinfo System overview
sysinfo all All information in one output
sysinfo gpu GPU model, driver version, VRAM usage, and utilization
sysinfo disk Disk usage per mount point / drive
sysinfo processes cpu Top processes by CPU usage
sysinfo processes memory Top processes by memory usage
sysinfo network interfaces Network interfaces, IPs, RX/TX stats
sysinfo network ports Listening ports and owning processes

Flags

Global Flags

Available on all commands:

--json, -j        Output as JSON
--watch, -w       Continuously refresh output in real time
--interval, -i    Refresh interval in seconds when using --watch (default 2)

Command Flags

sysinfo processes --count, -c    Number of processes to show (default 5)

Color Output

When running in a terminal, sysinfo color codes usage values automatically:

Color Meaning
🟒 Green Normal β€” below 70%
🟑 Yellow Warning β€” 70% to 89%
πŸ”΄ Red Critical β€” 90% and above

Color applies to:

  • sysinfo disk β€” USE% column
  • sysinfo gpu β€” Utilization value
  • sysinfo processes cpu β€” CPU% column
  • sysinfo processes memory β€” MEM% column
  • sysinfo all β€” USE%, Utilization, CPU%, and MEM% values

Color is automatically disabled when piping output or redirecting to a file so it does not interfere with tools like jq.

Usage Examples

# System overview
sysinfo

# All info at once
sysinfo all

# GPU details, VRAM, and utilization
sysinfo gpu

# Live watch mode (refreshes every 2s by default, or custom interval with -i)
sysinfo --watch
sysinfo gpu -w -i 1
sysinfo processes cpu -w

# Disk usage per mount / drive
sysinfo disk

# Top processes (default 5)
sysinfo processes cpu
sysinfo processes memory

# Custom process count
sysinfo processes cpu --count 10
sysinfo processes memory -c 3

# Network
sysinfo network interfaces
sysinfo network ports

# Elevated privileges may be required for full port ownership output on Linux/macOS
sudo sysinfo network ports

# JSON output (color disabled automatically)
sysinfo --json
sysinfo all --json
sysinfo gpu --json
sysinfo disk --json
sysinfo processes cpu --count 10 --json
sysinfo network interfaces --json

# Pipe JSON to jq
sysinfo --json | jq '.cpu'
sysinfo gpu --json | jq '.utilization'
sysinfo processes memory --json | jq '.[0]'

Project Structure

sysinfo/
β”œβ”€β”€ main.go                      # Entry point
β”œβ”€β”€ cmd/
β”‚   β”œβ”€β”€ root.go                  # Default sysinfo command & --watch loop
β”‚   β”œβ”€β”€ all.go                   # sysinfo all
β”‚   β”œβ”€β”€ gpu.go                   # sysinfo gpu
β”‚   β”œβ”€β”€ disk.go                  # sysinfo disk
β”‚   β”œβ”€β”€ processes.go             # sysinfo processes
β”‚   └── network.go               # sysinfo network
└── system/
    β”œβ”€β”€ common.go                # Shared cross-platform helpers
    β”œβ”€β”€ types.go                 # Shared data structures & JSON tags
    β”œβ”€β”€ color.go                 # ANSI color output & column padding helpers
    β”œβ”€β”€ color_windows.go         # Windows Virtual Terminal ANSI enablement
    β”œβ”€β”€ info_{linux,darwin,windows}.go
    β”œβ”€β”€ disk_{linux,darwin,windows}.go
    β”œβ”€β”€ gpu_{linux,darwin,windows}.go
    β”œβ”€β”€ processes_{linux,darwin,windows}.go
    └── network_{linux,darwin,windows}.go

Data Sources

Field Linux macOS (darwin) Windows
Host os.Hostname() os.Hostname() os.Hostname()
IP net.InterfaceAddrs() net.InterfaceAddrs() net.InterfaceAddrs()
OS /etc/os-release sw_vers Registry CurrentVersion
Kernel /proc/version uname -r Registry CurrentBuildNumber / UBR
Arch runtime.GOARCH runtime.GOARCH runtime.GOARCH
CPU /proc/cpuinfo sysctl machdep.cpu Registry CentralProcessor\0 + runtime.NumCPU()
Memory /proc/meminfo sysctl hw.memsize + vm_stat GlobalMemoryStatusEx (kernel32.dll)
Disk syscall.Statfs & /proc/mounts syscall.Getfsstat GetLogicalDrives + GetDiskFreeSpaceExW
Uptime /proc/uptime sysctl kern.boottime GetTickCount64 (kernel32.dll)
Load /proc/loadavg sysctl vm.loadavg n/a (Windows)
GPU nvidia-smi, rocm-smi, /sys/class/drm system_profiler SPDisplaysDataType nvidia-smi / Display Class Registry
Network stats /sys/class/net/[iface]/statistics netstat -I [iface] -b GetIfEntry2 (iphlpapi.dll)
Listening ports /proc/net/{tcp,tcp6,udp,udp6} + /proc/[pid]/fd lsof -nP GetExtendedTcpTable & GetExtendedUdpTable (iphlpapi.dll)
Process info /proc/[pid]/stat, /proc/[pid]/comm ps axo pid=,%cpu=,%mem=,comm= CreateToolhelp32Snapshot, GetProcessMemoryInfo, GetProcessTimes

Roadmap

Cross-Platform Support

  • Linux (amd64, arm64) β€” Direct /proc and /sys virtual filesystem readers
  • macOS (amd64, arm64) β€” Native syscall.Getfsstat and system utilities (sysctl, vm_stat, lsof, ps)
  • Windows (amd64, arm64) β€” Native Win32 API syscalls (kernel32.dll, iphlpapi.dll, psapi.dll) and Windows Registry

Shipped Enhancements

  • Dedicated sysinfo gpu subcommand exposing VRAM usage, driver version, and GPU utilization
  • Live watch / refresh mode (--watch / -w and --interval / -i)
  • Native Win32 GetExtendedTcpTable / GetExtendedUdpTable for Windows listening ports

Planned Down the Road

  • Real-Time Delta Sampling: Two-point snapshot sampling for instantaneous per-process CPU %, live network throughput rates (MB/s or Mbps RX/TX), and real-time Windows CPU load % via GetSystemTimes
  • Multi-GPU & Extended GPU Telemetry: Enumerate all adapters ([]GPUInfo for iGPU + dGPU setups), add GPU temperature, power draw (Watts), fan speed %, and registry-based VRAM reporting for AMD/Intel GPUs on Windows
  • Hardware Sensors & Battery Health (sysinfo sensors / sysinfo battery): CPU/system temperatures and fan speeds via Linux hwmon/thermal_zone, macOS pmset/ioreg, and laptop battery health/runtime via Windows GetSystemPowerStatus
  • Version Metadata & Self-Update (sysinfo version / sysinfo upgrade): Build-time -ldflags version/commit injection, binary stripping (-s -w), and in-place binary upgrades from GitHub Releases
  • Package Manager Distribution & Checksums: Automated checksums.txt (SHA256) release assets, Homebrew tap (brew install), Windows Scoop bucket, and Winget manifest (winget install)
  • Automated Unit & Cross-OS Integration Tests: Unit tests for /proc, sysctl, and Win32 parsers plus live binary execution checks across Linux, macOS, and Windows GitHub Actions runners
  • Healthcheck & Threshold Alerting (sysinfo check): Configurable warning/critical thresholds (e.g., --disk 90 --mem 85 --cpu 90) returning non-zero exit codes for cron jobs, CI pipelines, and server monitoring scripts

About

A lightweight system information CLI tool written in Go. No external dependencies.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages