• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

How to do top in batch mode and sort by ram?

Red Squirrel

No Lifer
I was going through the man page and it mentions you can use -o to sort by different elements such as ram. So I figured I'd try -o=m for memory but after guessing the syntax a few times I don't think -o even exists. (Tried -O too).

Anyone know of a way to sort when using batch mode?

 
Do you mean 'ps'?

ps aux --sort rss # sort by resident-state size

rss is a measure of the physical RAM in use by a process. You didn't specify if you wanted physical frame usage, or virtual address space size.
 
I prefer top, as it shows the actual ram usage not just the %, or is there a way to get the actual on there? The most info I can get the better, as I'm using this in a php script to display system info in a web app with search and sort feature.
 
Ok I figured it out, I can specify what I want with -o. RSS is good, but is there a way to get a total amount of memory so counting swap etc, or at least individual (I can always add it up)?
 
but is there a way to get a total amount of memory so counting swap etc, or at least individual (I can always add it up)?

Not really because it'll never be completely accurate. Even the RSS and swap counters aren't completely right because of shared pages, swap caching, etc.
 
Back
Top