Getting only used memory from free command every few seconds
0
votes
2
answers
537
views
It was explained e.g. here:
https://unix.stackexchange.com/questions/68526/get-separate-used-memory-info-from-free-m-command
how to cut the output of
free
command. But I want to do this every few seconds and log it to a file. So I tried:
free -g -s2 | sed -n 's/^Mem:\s\+[0-9]\+\s\+\([0-9]\+\)\s.\+/\1/p' >> memory2.log
but the file stays empty. Why is that and how to fix it?
Asked by Aleksander
(5 rep)
Aug 17, 2023, 09:54 AM
Last activity: Aug 17, 2023, 12:23 PM
Last activity: Aug 17, 2023, 12:23 PM