ram_too_much_lines 493 B

1234567891011121314151617181920
  1. #!/usr/bin/env bash
  2. total_mebi=$(free --mebi | grep Mem: | awk '{print $2}')
  3. used_mebi=$(free --mebi | grep Mem: | awk '{print $3}')
  4. total_gibi=$(echo "${total_mebi}/1024" | bc -l)
  5. used_gibi=$(echo "${used_mebi}/1024" | bc -l)
  6. pct=$(echo "${used_mebi}/${total_mebi}*100" | bc -l)
  7. # full_text
  8. printf "%.1fGiB/%.1fGiB (%.0f%%)\n" $total_gibi $used_gibi $pct
  9. # short_text
  10. printf "%.0f%%\n" $pct
  11. case $BLOCK_BUTTON in
  12. 1) ~/.myScripts/top5_mem_usage.sh;;
  13. 3) alacritty -e htop;;
  14. esac