I need to get all process ids which have memory usage greater or lower than predifined number. For example get id where memory (rss) usage grater than 10MB and then using this id kill each process. Thanks
相关问题
- Is shmid returned by shmget() unique across proces
- how to get running process information in java?
- JQ: Select when attribute value exists in a bash a
- Error building gcc 4.8.3 from source: libstdc++.so
- Why should we check WIFEXITED after wait in order
This following command will help I think,
Try it.
That's not a good idea. You will certainly kill processes you should not and might render your system damaged in the process. But anyway, here's what does the trick:
You might want to replace the
echo
line by a line usingkill
directly, but as I said, this will probably kill processes you should not kill.The line with the
continue
is meant to skip all processes which are not of a specific user; I just assumed that; if you intend to run this asroot
, feel free to remove that line.