Skip to content

Instantly share code, notes, and snippets.

@conorbot
Last active November 24, 2025 09:20
Show Gist options
  • Select an option

  • Save conorbot/0f59870df838291fd266d32b61d8856d to your computer and use it in GitHub Desktop.

Select an option

Save conorbot/0f59870df838291fd266d32b61d8856d to your computer and use it in GitHub Desktop.
lapcheck.sh
#!/bin/bash
echo "=== SYSTEM SPEC CHECK ==="
echo
# CPU
echo "-- CPU --"
lscpu | grep -E 'Model name|CPU\(s\)' || echo "CPU info unavailable"
echo
# RAM
echo "-- RAM --"
free -h | grep Mem || echo "RAM info unavailable"
echo
echo "Detailed RAM:"
sudo dmidecode -t memory 2>/dev/null | grep -E 'Size:|Speed:|Type:' | sed 's/^[ \t]*//' || echo "dmidecode unavailable (need root)"
echo
# Battery
echo "-- BATTERY --"
BATDIR="/sys/class/power_supply"
if ls $BATDIR | grep -q BAT; then
BAT=$(ls $BATDIR | grep BAT | head -n 1)
BD="$BATDIR/$BAT"
echo "Battery detected: $BAT"
# Current full capacity
if [[ -f "$BD/energy_full" ]]; then
FULL=$(cat "$BD/energy_full")
DESIGN=$(cat "$BD/energy_full_design")
elif [[ -f "$BD/charge_full" ]]; then
FULL=$(cat "$BD/charge_full")
DESIGN=$(cat "$BD/charge_full_design")
fi
if [[ ! -z "$FULL" ]]; then
HEALTH=$(( 100 * FULL / DESIGN ))
echo "Health: $HEALTH% (Full: $FULL, Design: $DESIGN)"
fi
# Cycle count
if [[ -f "$BD/cycle_count" ]]; then
echo "Cycle count: $(cat $BD/cycle_count)"
else
echo "Cycle count: Not reported"
fi
else
echo "No battery found"
fi
echo
echo "=== DONE ==="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment