My problem is I don't know how to extract that "3008" from the free command from the command line
Dado este resultado:
free -lm
total used free shared buffers cached
Mem: 3757 1765 1991 138 122 766
Low: 3757 1765 1991
High: 0 0 0
-/+ buffers/cache: 876 2880
Swap: 7772 0 7772
Tente isto:
free -lm | grep '^Mem' | awk '{ print $2 }'
3757
Que retornará a coluna total
na linha Mem:
. No meu caso 3757
.