0

In relation to this:

https://unix.stackexchange.com/a/754252/582781

Solution 1:

free -g -s2 | sed -u -n 's/^Mem:\s\+[0-9]\+\s\+\([0-9]\+\)\s.\+/\1/p' >> memory.log

Is there a way to add Swap to this, so that I would log the sum of used Mem and Swap?

1 Answer 1

0

Using AWK:

free -g -s2 | stdbuf -o0 awk '/^Mem/ { u = $3 } /^Swap/ { print u + $3 }' >> memory.log
0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.