12 lines
325 B
Bash
Executable file
12 lines
325 B
Bash
Executable file
#!/usr/bin/env bash
|
|
# Get the percentage of used memory and print it
|
|
read used total <<< $(free -m | awk '/Mem/{printf $2" "$3}')
|
|
|
|
percent=$(bc -l <<< "100 * $total / $used")
|
|
|
|
mem=$(awk -v u=$used -v t=$total -v p=$percent 'BEGIN {printf "%sMi/%sMi %.1f% ", t, u, p}')
|
|
|
|
memperc=$(echo $mem | awk '{print $2}')
|
|
|
|
echo $memperc
|