Question

I`m newbie with Linux so... I have a exercise to do: using only ps, grep, awk, gawk determine total amount of memory processes used by SQL. How i can determine with ps how much memory used by any process? Mem in ps displaying in percents... Thanks alot.

Was it helpful?

Solution

ps auwx | awk '/[s]ql/ {total += $4} END {print total}'

You might want to look for $11 ~ /sql/ instead to find actual (my)sql processes instead of any command with "sql" in any argument.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top