Skip to content

Instantly share code, notes, and snippets.

@dylarcher
Last active August 20, 2025 21:07
Show Gist options
  • Select an option

  • Save dylarcher/4d67f456cb2497f37da1f26fc893d091 to your computer and use it in GitHub Desktop.

Select an option

Save dylarcher/4d67f456cb2497f37da1f26fc893d091 to your computer and use it in GitHub Desktop.
Generates a markdown file with all system information
#!/bin/bash
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
OUTPUT_FILE="system_info_${TIMESTAMP}.md"
echo "Collecting system information..."
echo "Output will be saved to: $OUTPUT_FILE"
cat > "$OUTPUT_FILE" <<EOL
# System Information Report
Generated on: $(date)
---
EOL
add_section() {
local title="$1"
local command="$2"
{
echo "## $title"
echo ""
echo '```'
eval "$command" 2>&1
echo '```'
echo ""
} >> "$OUTPUT_FILE"
}
echo "Collecting Software and Hardware Data Types..."
add_section "Software and Hardware Data Types" "system_profiler SPSoftwareDataType SPHardwareDataType"
echo "Collecting Full System Profile..."
add_section "Complete System Profile" "system_profiler"
echo "Collecting System Information (uname)..."
add_section "System Information (uname -a)" "uname -a"
echo "Collecting CPU Information..."
add_section "CPU Brand" "sysctl -n machdep.cpu.brand_string"
add_section "CPU Core Count" "sysctl -n hw.ncpu"
echo "Collecting Memory Statistics..."
add_section "Virtual Memory Statistics" "vm_stat"
add_section "Physical Memory Information" "top -l 1 -s 0 | grep PhysMem"
echo "Collecting Disk Usage..."
add_section "Disk Usage" "df -h"
echo "Collecting Network Configuration..."
add_section "Network Interface Configuration" "ifconfig"
add_section "Network Hardware Ports" "networksetup -listallhardwareports"
{
echo "---"
echo ""
echo "Report completed on: $(date)"
} >> "$OUTPUT_FILE"
echo "System information collection completed!"
echo "Report saved to: $OUTPUT_FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment