2017-04-20 9 views
0
私は、全体的なCPU使用率や割合でRAM使用量をfindoutしたいのですが、私は成功に

全体的なCPUの使用率およびLinuxでの割合でのメモリ(RAM)の使用/ Ubuntuの

$ command for cpu usage 
4.85% 

$ command for memory usage 
15.15% 

OR

$ command for cpu and mamory usage 
cpu: 4.85% 
mem: 15.15% 
を得るくぼみ

どうすればいいですか?

+0

http://stackoverflow.com/questions/10585978/linux-command-for-percentage-of-memory-that -is-free – Kris

+1

[LinuxでのCPU使用率(例えば57%)の取得方法]の複製可能性(http://stackoverflow.com/questions/9229333/how-to-get-overall-cpu-usage-eg- 57-on-linux) – Kris

答えて

3

procpsパッケージのtopおよび/またはvmstatを使用できます。 vmstat -sを使用してマシンのRAM容量を取得します(オプション)。 は、topの出力を使用してメモリ使用率を計算します。

%Cpu(s): 3.8 us, 2.8 sy, 0.4 ni, 92.0 id, 1.0 wa, 0.0 hi, 0.0 si, 0.0 st 
KiB Mem : 24679620 total, 1705524 free, 7735748 used, 15238348 buff/cache 
KiB Swap:  0 total,  0 free,  0 used. 16161296 avail Mem 

あなたはまた、比較的短い出力のためにこれを行うことができます。

watch '/usr/bin/top -b | head -4 | tail -2'

関連する問題