ps -vxa 不對記憶體進行排序

ps -vxa 不對記憶體進行排序

FreeBSD 線上說明頁ps說:

-v   Display information associated with the following keywords: pid,
     state, time, sl, re, pagein, vsz, rss, lim, tsiz, %cpu, %mem, and
     command.  The -v option implies the -m option.

但它似乎根本不是這樣運作的。-m應該按記憶體使用量排序:

-m   Sort by memory usage, instead of the combination of controlling
     terminal and process ID.

但這是以下的部分輸出ps -vxa

 PID STAT    TIME  SL  RE PAGEIN     VSZ    RSS LIM TSIZ  %CPU %MEM COMMAND
 ...
 871 Is   0:00.04 127 127     10   75620   7704   -  400   0.0  0.1 /usr/lo
1043 S    0:03.18   0 127   9599 1656244 253048   -  172   0.0  3.1 /usr/lo
1046 S    0:09.48   0 127    412 1672996 264060   -  172   0.0  3.3 /usr/lo
 873 I    0:00.14 127 127    123   65956  11432   -  280   0.0  0.1 /usr/lo

那麼,這裡發生了什麼事?我們從 的描述中假設的排序在哪裡-m

答案1

排序就在那裡。

問題是您期望它在按“記憶體使用情況”排序時對單個可見字段進行排序。它的記錄很差,但是排序所依據的「記憶體使用情況」是一個不可見且實際上無法列印的字段,它是dsizssiz和字段的總和tsiz

相關內容