親コマンドと+および*記号

親コマンドと+および*記号

以下のtopコマンドを使用してメモリ使用量を取得しようとしています。

KiB Mem :  8009480 total,  1438848 free,  1964392 used, 4606240 buff/cache 
KiB Swap:  7340028 total,  5302364 free,  2037664 used. 5202692 avail Mem
top -p $PID -n 1 -b | grep 'KiB Mem :' | awk -F, '{print $3}'
1963780 used

奇妙なことは、私が受け取る出力が次のようになることです。

*"15108960+used"*

時々、記号が現れる理由を理解できません+*

マニュアルページにこれに関する情報が見つかりません。

それはどういう意味ですか?出力からコマンドを除いてtopコマンドを印刷する方法。*+

注:CentOsシステムで実行されています。

ベストアンサー1

まず、topこれはマシンのメモリに関する情報を取得する良い方法ではありません。このfreeコマンドは、メモリ情報を取得するために使用されます。を使用することもできますvmstat -s

これで、要約領域に文字は表示されませんが、topシンボルの説明はのマニュアルページに表示されます。*+top(1):

          If you see a `+' between a displayed number and the
          following label, it means that top was forced to truncate
          some portion of that number.  By raising the scaling
          factor, such truncation can be avoided.

-Eフラグまたはインタラクティブコマンドを使用して、サイズ変更をKiBから別の値に変更できますE

   -E  :Enforce-Summary-Memory-Scaling as:  -E  k | m | g | t | p | e
        Instructs top to force summary area memory to be scaled as:
           k - kibibytes
           m - mebibytes
           g - gibibytes
           t - tebibytes
           p - pebibytes
           e - exbibytes

        Later this can be changed with the `E' command toggle.

たとえば、-Emサイズ変更を KiB から MiB に変更します。

しかし、もう一度申し上げますが、メモリ情報だけを取得するには使用しないでtopくださいfree

おすすめ記事