Skip to content

Instantly share code, notes, and snippets.

@pyaf
Last active June 28, 2020 07:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pyaf/31e375584cb8cd3322fe0c3029914d07 to your computer and use it in GitHub Desktop.
Save pyaf/31e375584cb8cd3322fe0c3029914d07 to your computer and use it in GitHub Desktop.
Bash script for GPU usage and utilization monitoring in i3status bar.
#!/bin/bash
output=$(nvidia-smi --format=csv,noheader --query-gpu=name,power.draw,fan.speed,utilization.gpu,temperature.gpu,memory.used,memory.total)
IFS=',' read -r -a array <<< "$output"
name=${array[0]}
power=${array[1]}
fan=${array[2]}
util=${array[3]}
temp=${array[4]}
used=${array[5]}
total=${array[6]}
echo "$name:$used /$total,$util,$temp°C"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment