nixos/home/hyprland/ironbar/reference/scripts/mem-ad

15 lines
324 B
Plaintext
Raw Normal View History

2023-10-10 20:00:04 +01:00
#!/bin/sh
total="$(free -m | grep Mem: | awk '{ print $2 }')"
used="$(free -m | grep Mem: | awk '{ print $3 }')"
shared="$(free -m | grep Mem: | awk '{ print $5 }')"
free=$(expr $total - $used - $shared)
true_used=$(expr $shared + $used)
case $1 in
total) echo $total;;
used) echo $true_used;;
free) echo $free;;
esac