Skip to content

Instantly share code, notes, and snippets.

@bryanveloso
Last active July 3, 2025 22:18
Show Gist options
  • Save bryanveloso/1f2226c9ad232c72ad2993029d155f9f to your computer and use it in GitHub Desktop.
Save bryanveloso/1f2226c9ad232c72ad2993029d155f9f to your computer and use it in GitHub Desktop.
Machine information gathering scripts.
#!/bin/bash
echo "=== MACHINE INFORMATION ==="
echo "**Machine Name:** $(hostname)"
echo "**OS:** $(lsb_release -d 2>/dev/null | cut -f2 || cat /etc/os-release | grep PRETTY_NAME | cut -d'"' -f2)"
echo "**Architecture:** $(uname -m)"
# CPU Info
echo "**CPU:** $(lscpu | grep 'Model name' | cut -d':' -f2 | sed 's/^[ \t]*//')"
echo "**CPU Cores:** $(nproc) cores"
# RAM Info
RAM_KB=$(grep MemTotal /proc/meminfo | awk '{print $2}')
RAM_GB=$((RAM_KB / 1024 / 1024))
echo "**RAM:** ${RAM_GB}GB"
# GPU Info
echo "**GPU:**"
if command -v lspci &> /dev/null; then
GPU_INFO=$(lspci | grep -i vga | cut -d':' -f3 | sed 's/^[ \t]*//')
if [ -z "$GPU_INFO" ]; then
echo " Integrated or not detected"
else
echo " $GPU_INFO"
fi
# Check for additional GPUs (like discrete NVIDIA/AMD)
DISCRETE_GPU=$(lspci | grep -i '3d\|display' | grep -v vga | cut -d':' -f3 | sed 's/^[ \t]*//')
if [ ! -z "$DISCRETE_GPU" ]; then
echo " Additional: $DISCRETE_GPU"
fi
else
echo " Cannot detect (lspci not available)"
fi
# Storage Info
echo "**Storage:**"
df -h --total | grep total | awk '{print " Total Available: " $2}'
echo " Main drives:"
lsblk -d -o NAME,SIZE,TYPE | grep disk | while read line; do
echo " $line"
done
# Form Factor (best guess)
echo "**Form Factor:** $(if [ -d /sys/class/power_supply/BAT* ]; then echo "Laptop"; else echo "Desktop/Server"; fi)"
# Check if running in VM
echo "**Virtualization:** $(if [ -f /proc/cpuinfo ] && grep -q hypervisor /proc/cpuinfo; then echo "Virtual Machine"; else echo "Physical Machine"; fi)"
echo ""
echo "=== END MACHINE INFO ==="
#!/bin/bash
echo "=== MACHINE INFORMATION ==="
# Machine Name
echo "**Machine Name:** $(scutil --get ComputerName)"
# OS Info
OS_VERSION=$(sw_vers -productVersion)
OS_BUILD=$(sw_vers -buildVersion)
echo "**OS:** macOS $OS_VERSION (Build $OS_BUILD)"
# Architecture
ARCH=$(uname -m)
if [ "$ARCH" = "arm64" ]; then
echo "**Architecture:** Apple Silicon (ARM64)"
else
echo "**Architecture:** Intel (x86_64)"
fi
# CPU Info
CPU_INFO=$(sysctl -n machdep.cpu.brand_string 2>/dev/null)
if [ -z "$CPU_INFO" ]; then
# Fallback for Apple Silicon
CPU_INFO=$(system_profiler SPHardwareDataType | grep "Chip:" | cut -d: -f2 | sed 's/^[ \t]*//')
fi
CORE_COUNT=$(sysctl -n hw.ncpu)
echo "**CPU:** $CPU_INFO"
echo "**CPU Cores:** $CORE_COUNT cores"
# RAM Info
RAM_BYTES=$(sysctl -n hw.memsize)
RAM_GB=$((RAM_BYTES / 1024 / 1024 / 1024))
echo "**RAM:** ${RAM_GB}GB"
# GPU Info
echo "**GPU:**"
if [ "$ARCH" = "arm64" ]; then
# Apple Silicon - integrated GPU
echo " Integrated Apple GPU"
else
# Intel Mac - check for discrete GPU
GPU_INFO=$(system_profiler SPDisplaysDataType | grep "Chipset Model:" | cut -d: -f2 | sed 's/^[ \t]*//')
if [ ! -z "$GPU_INFO" ]; then
echo "$GPU_INFO" | while read gpu; do
echo " $gpu"
done
else
echo " Integrated Intel Graphics"
fi
fi
# Storage Info
echo "**Storage:**"
TOTAL_STORAGE=$(df -h / | tail -1 | awk '{print $2}')
echo " Total Available: $TOTAL_STORAGE"
# Get individual drives
diskutil list | grep "/dev/disk" | grep -v "virtual\|synthesized" | while read line; do
DISK=$(echo $line | awk '{print $1}')
SIZE=$(diskutil info $DISK 2>/dev/null | grep "Total Size" | cut -d: -f2 | sed 's/^[ \t]*//' | cut -d'(' -f1)
if [ ! -z "$SIZE" ]; then
echo " Drive: $SIZE"
fi
done
# Form Factor
MODEL=$(system_profiler SPHardwareDataType | grep "Model Name:" | cut -d: -f2 | sed 's/^[ \t]*//')
if [[ $MODEL == *"MacBook"* ]]; then
FORM_FACTOR="Laptop"
elif [[ $MODEL == *"iMac"* ]]; then
FORM_FACTOR="All-in-One Desktop"
elif [[ $MODEL == *"Mac mini"* ]]; then
FORM_FACTOR="Mini Desktop"
elif [[ $MODEL == *"Mac Studio"* ]]; then
FORM_FACTOR="Compact Desktop"
elif [[ $MODEL == *"Mac Pro"* ]]; then
FORM_FACTOR="Workstation"
else
FORM_FACTOR="Desktop"
fi
echo "**Form Factor:** $FORM_FACTOR ($MODEL)"
# Virtualization check
HYPERVISOR=$(sysctl -n kern.hv_support 2>/dev/null)
if [ "$HYPERVISOR" = "1" ]; then
echo "**Virtualization:** Physical Machine (Hypervisor capable)"
else
echo "**Virtualization:** Physical Machine"
fi
echo ""
echo "=== END MACHINE INFO ==="
#!/bin/bash
echo "=== UNRAID HOMELAB INFORMATION COLLECTION ==="
echo "Collecting comprehensive Unraid system information..."
echo ""
# =========================
# BASIC SYSTEM INFORMATION
# =========================
echo "=== BASIC SYSTEM INFO ==="
echo "Hostname: $(hostname)"
# Unraid Version
if [ -f /etc/unraid-version ]; then
echo "Unraid Version: $(cat /etc/unraid-version)"
else
echo "Unraid Version: $(cat /etc/os-release | grep PRETTY_NAME | cut -d'"' -f2)"
fi
echo "Kernel: $(uname -r)"
echo "Architecture: $(uname -m)"
# System Uptime
UPTIME=$(uptime -p)
echo "Uptime: $UPTIME"
# Boot Time
BOOT_TIME=$(uptime -s)
echo "Last Boot: $BOOT_TIME"
echo ""
# =========================
# HARDWARE SPECIFICATIONS
# =========================
echo "=== HARDWARE SPECIFICATIONS ==="
# Motherboard/System Info
if [ -f /sys/class/dmi/id/board_vendor ]; then
echo "Motherboard Vendor: $(cat /sys/class/dmi/id/board_vendor)"
echo "Motherboard Model: $(cat /sys/class/dmi/id/board_name)"
fi
if [ -f /sys/class/dmi/id/product_name ]; then
echo "System Model: $(cat /sys/class/dmi/id/product_name)"
fi
# CPU Information
CPU_MODEL=$(grep "model name" /proc/cpuinfo | head -1 | cut -d':' -f2 | sed 's/^[ \t]*//')
CPU_CORES=$(nproc)
CPU_THREADS=$(grep -c processor /proc/cpuinfo)
echo "CPU: $CPU_MODEL"
echo "CPU Cores: $CPU_CORES cores, $CPU_THREADS threads"
# Memory Information
TOTAL_MEM_KB=$(grep MemTotal /proc/meminfo | awk '{print $2}')
TOTAL_MEM_GB=$((TOTAL_MEM_KB / 1024 / 1024))
echo "Total RAM: ${TOTAL_MEM_GB}GB"
# Memory modules (if available)
if command -v dmidecode &> /dev/null; then
echo "Memory Modules:"
dmidecode -t memory | grep -A 16 "Memory Device" | grep -E "Size:|Speed:|Manufacturer:" | grep -v "No Module" | while read line; do
if [[ $line == *"Size:"* ]] && [[ $line != *"No Module"* ]]; then
SIZE=$(echo $line | cut -d':' -f2 | sed 's/^[ \t]*//')
read -r SPEED_LINE
SPEED=$(echo $SPEED_LINE | cut -d':' -f2 | sed 's/^[ \t]*//')
read -r MFG_LINE
MFG=$(echo $MFG_LINE | cut -d':' -f2 | sed 's/^[ \t]*//')
echo " - $SIZE @ $SPEED ($MFG)"
fi
done
else
echo "Memory Modules: dmidecode not available"
fi
# GPU Information
echo "GPU(s):"
if command -v lspci &> /dev/null; then
lspci | grep -i vga | while read line; do
GPU_NAME=$(echo $line | cut -d':' -f3 | sed 's/^[ \t]*//')
echo " $GPU_NAME"
done
# Additional display controllers
lspci | grep -i '3d\|display' | grep -v VGA | while read line; do
GPU_NAME=$(echo $line | cut -d':' -f3 | sed 's/^[ \t]*//')
echo " Additional: $GPU_NAME"
done
else
echo " lspci not available"
fi
echo ""
# =========================
# UNRAID ARRAY INFORMATION
# =========================
echo "=== UNRAID ARRAY STATUS ==="
# Array status
if command -v mdcmd &> /dev/null; then
echo "Array Status:"
mdcmd status | grep -E "mdState|mdNumDisks|mdNumInvalid|mdNumMissing"
echo ""
fi
# Disk information
echo "Storage Devices:"
lsblk -d -o NAME,SIZE,TYPE,MODEL | grep disk | while read line; do
echo " $line"
done
echo ""
# Individual drive details
echo "Drive Details:"
for disk in $(lsblk -d -n -o NAME | grep -E '^sd[a-z]$|^nvme[0-9]n[0-9]$'); do
SIZE=$(lsblk -d -n -o SIZE /dev/$disk)
MODEL=$(lsblk -d -n -o MODEL /dev/$disk)
echo " $disk: $SIZE - $MODEL"
done
echo ""
# Array usage if available
if [ -d /mnt/user ]; then
echo "Array Usage:"
df -h /mnt/user* 2>/dev/null | grep -v "Filesystem" | while read line; do
echo " $line"
done
echo ""
fi
# =========================
# NETWORK CONFIGURATION
# =========================
echo "=== NETWORK CONFIGURATION ==="
# Network interfaces
ip addr show | grep -E "^[0-9]+:|inet " | while read line; do
if [[ $line == *"state UP"* ]]; then
INTERFACE=$(echo $line | cut -d':' -f2 | sed 's/^[ \t]*//')
echo "Interface: $INTERFACE"
elif [[ $line == *"inet "* ]] && [[ $line != *"127.0.0.1"* ]]; then
IP=$(echo $line | awk '{print $2}')
echo " IP: $IP"
fi
done
# Default gateway
GATEWAY=$(ip route | grep default | awk '{print $3}' | head -1)
echo "Default Gateway: $GATEWAY"
# DNS servers
if [ -f /etc/resolv.conf ]; then
echo "DNS Servers:"
grep nameserver /etc/resolv.conf | awk '{print " " $2}'
fi
echo ""
# =========================
# DOCKER CONTAINERS
# =========================
echo "=== DOCKER CONTAINERS ==="
if command -v docker &> /dev/null; then
echo "Docker Version: $(docker --version)"
echo ""
echo "Running Containers:"
docker ps --format "table {{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}" | head -20
echo ""
CONTAINER_COUNT=$(docker ps -q | wc -l)
echo "Total Running Containers: $CONTAINER_COUNT"
echo ""
echo "Container Resource Usage:"
docker stats --no-stream --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}" | head -10
else
echo "Docker: Not installed or not accessible"
fi
echo ""
# =========================
# VIRTUAL MACHINES
# =========================
echo "=== VIRTUAL MACHINES ==="
if [ -d /etc/libvirt/qemu ]; then
echo "VM Configurations found:"
ls /etc/libvirt/qemu/*.xml 2>/dev/null | wc -l | awk '{print " Total VMs: " $1}'
if command -v virsh &> /dev/null; then
echo "VM Status:"
virsh list --all 2>/dev/null | grep -v "^$" | tail -n +3
fi
else
echo "No VMs configured"
fi
echo ""
# =========================
# UNRAID SHARES
# =========================
echo "=== UNRAID SHARES ==="
if [ -d /mnt/user ]; then
echo "User Shares:"
ls -la /mnt/user/ | grep "^d" | awk '{print " " $9}' | grep -v "^\.$\|^\.\.$"
echo ""
fi
# Share configuration
if [ -d /boot/config/shares ]; then
SHARE_COUNT=$(ls /boot/config/shares/*.cfg 2>/dev/null | wc -l)
echo "Configured Shares: $SHARE_COUNT"
fi
echo ""
# =========================
# PERFORMANCE METRICS
# =========================
echo "=== PERFORMANCE METRICS ==="
# CPU Usage
CPU_USAGE=$(top -bn1 | grep "Cpu(s)" | awk '{print $2}' | sed 's/%us,//')
echo "CPU Usage: ${CPU_USAGE}%"
# Memory Usage
USED_MEM_KB=$(grep MemAvailable /proc/meminfo | awk '{print $2}')
USED_MEM_GB=$(((TOTAL_MEM_KB - USED_MEM_KB) / 1024 / 1024))
AVAILABLE_MEM_GB=$((USED_MEM_KB / 1024 / 1024))
MEM_PERCENT=$(((USED_MEM_GB * 100) / TOTAL_MEM_GB))
echo "Memory Usage: ${USED_MEM_GB}GB / ${TOTAL_MEM_GB}GB (${MEM_PERCENT}%)"
# Load Average
LOAD_AVG=$(uptime | awk -F'load average:' '{print $2}')
echo "Load Average:$LOAD_AVG"
# Process Count
PROCESS_COUNT=$(ps aux | wc -l)
echo "Running Processes: $PROCESS_COUNT"
# Disk I/O if iostat available
if command -v iostat &> /dev/null; then
echo "Disk I/O (current):"
iostat -x 1 1 | grep -E "^sd|^nvme" | head -5
fi
echo ""
# =========================
# UNRAID PLUGINS
# =========================
echo "=== INSTALLED PLUGINS ==="
if [ -d /var/log/plugins ]; then
echo "Installed Plugins:"
ls /var/log/plugins/*.plg 2>/dev/null | xargs -I {} basename {} .plg | while read plugin; do
echo " - $plugin"
done
else
echo "No plugins directory found"
fi
echo ""
# =========================
# SYSTEM TEMPERATURES
# =========================
echo "=== SYSTEM TEMPERATURES ==="
if command -v sensors &> /dev/null; then
echo "Temperature Sensors:"
sensors | grep -E "Core|temp" | head -10
else
echo "lm-sensors not available"
fi
echo ""
# =========================
# UNRAID CONFIGURATION
# =========================
echo "=== UNRAID CONFIGURATION ==="
# Parity drives
if [ -f /var/local/emhttp/disks.ini ]; then
echo "Parity Configuration:"
grep -E "device|size" /var/local/emhttp/disks.ini | grep -A1 "parity" | head -10
fi
# Cache drives
echo "Cache/Pool Information:"
if command -v btrfs &> /dev/null; then
btrfs filesystem show 2>/dev/null | grep -E "Label|Total devices"
fi
# Notification settings
if [ -f /boot/config/notifications.cfg ]; then
echo "Notifications: Configured"
else
echo "Notifications: Not configured"
fi
echo ""
# =========================
# SECURITY INFORMATION
# =========================
echo "=== SECURITY & ACCESS ==="
# SSH status
if pgrep sshd > /dev/null; then
echo "SSH: Running"
echo "SSH Port: $(grep "^Port" /etc/ssh/sshd_config 2>/dev/null | awk '{print $2}' || echo "22 (default)")"
else
echo "SSH: Not running"
fi
# User accounts
echo "User Accounts:"
if [ -f /boot/config/passwd ]; then
grep -v "^#" /boot/config/passwd | cut -d':' -f1 | while read user; do
echo " - $user"
done
else
echo " No custom users configured"
fi
# Unraid login security
if [ -f /boot/config/ident.cfg ]; then
echo "Unraid WebUI: Password protected"
else
echo "Unraid WebUI: Check security settings"
fi
echo ""
# =========================
# ADDITIONAL INFORMATION
# =========================
echo "=== ADDITIONAL SYSTEM INFO ==="
# Flash drive info
echo "Flash Drive (USB Boot):"
if [ -d /boot ]; then
FLASH_SIZE=$(df -h /boot | tail -1 | awk '{print $2}')
FLASH_USED=$(df -h /boot | tail -1 | awk '{print $3}')
FLASH_AVAIL=$(df -h /boot | tail -1 | awk '{print $4}')
echo " Size: $FLASH_SIZE, Used: $FLASH_USED, Available: $FLASH_AVAIL"
fi
# Log file sizes
echo "Log Directory Usage:"
du -sh /var/log 2>/dev/null | awk '{print " /var/log: " $1}'
# Unraid license
if [ -f /boot/config/Pro.key ]; then
echo "License: Unraid Pro"
elif [ -f /boot/config/Plus.key ]; then
echo "License: Unraid Plus"
elif [ -f /boot/config/Basic.key ]; then
echo "License: Unraid Basic"
else
echo "License: Trial or unregistered"
fi
echo ""
echo "=== DATA COLLECTION COMPLETE ==="
echo "Please copy all the output above and provide it for documentation creation."
# Windows Machine Information Script
# Save as: machine_info.ps1
# Run in PowerShell as: .\machine_info.ps1
Write-Host "=== MACHINE INFORMATION ===" -ForegroundColor Green
# Machine Name
Write-Host "**Machine Name:** $env:COMPUTERNAME"
# OS Info
$os = Get-CimInstance Win32_OperatingSystem
Write-Host "**OS:** $($os.Caption) (Build $($os.BuildNumber))"
Write-Host "**Architecture:** $($os.OSArchitecture)"
# CPU Info
$cpu = Get-CimInstance Win32_Processor | Select-Object -First 1
Write-Host "**CPU:** $($cpu.Name.Trim())"
Write-Host "**CPU Cores:** $($cpu.NumberOfCores) cores, $($cpu.NumberOfLogicalProcessors) threads"
# RAM Info
$totalRAM = [math]::Round((Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory / 1GB, 0)
Write-Host "**RAM:** ${totalRAM}GB"
# GPU Info
Write-Host "**GPU:**"
$gpus = Get-CimInstance Win32_VideoController | Where-Object { $_.Name -notlike "*Remote*" -and $_.Name -notlike "*Mirror*" }
foreach ($gpu in $gpus) {
if ($gpu.Name) {
Write-Host " $($gpu.Name)"
if ($gpu.AdapterRAM -and $gpu.AdapterRAM -gt 0) {
$vram = [math]::Round($gpu.AdapterRAM / 1GB, 1)
Write-Host " VRAM: ${vram}GB"
}
}
}
# Storage Info
Write-Host "**Storage:**"
$disks = Get-CimInstance Win32_DiskDrive | Where-Object { $_.MediaType -eq "Fixed hard disk media" }
foreach ($disk in $disks) {
$size = [math]::Round($disk.Size / 1GB, 0)
$model = $disk.Model
Write-Host " $model - ${size}GB"
}
# Form Factor
$chassis = (Get-CimInstance Win32_SystemEnclosure).ChassisTypes[0]
$formFactor = switch ($chassis) {
8 { "Laptop" }
9 { "Laptop" }
10 { "Laptop" }
14 { "Laptop" }
3 { "Desktop" }
4 { "Desktop" }
5 { "Desktop" }
6 { "Desktop" }
7 { "Desktop" }
15 { "Desktop" }
16 { "Desktop" }
default { "Unknown" }
}
Write-Host "**Form Factor:** $formFactor"
# Check for virtualization
$computerSystem = Get-CimInstance Win32_ComputerSystem
if ($computerSystem.Model -like "*Virtual*" -or $computerSystem.Manufacturer -like "*VMware*" -or $computerSystem.Manufacturer -like "*Microsoft*") {
Write-Host "**Virtualization:** Virtual Machine"
} else {
Write-Host "**Virtualization:** Physical Machine"
}
Write-Host ""
Write-Host "=== END MACHINE INFO ===" -ForegroundColor Green
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment