Last active
November 24, 2025 09:20
-
-
Save conorbot/0f59870df838291fd266d32b61d8856d to your computer and use it in GitHub Desktop.
lapcheck.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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