Posted March 27, 2016
Check CPU Usage
Type “top” to see a multitude of information, constantly updated:
1 2 3 |
top |
Output:
1 2 3 4 5 6 7 |
top - 02:11:29 up 71 days, 19:36, 1 user, load average: 0.38, 0.34, 0.39 Tasks: 101 total, 1 running, 100 sleeping, 0 stopped, 0 zombie Cpu(s): 0.0%us, 0.1%sy, 0.0%ni, 99.8%id, 0.0%wa, 0.0%hi, 0.0%si, 0.1%st Mem: 4031024k total, 3385796k used, 645228k free, 339668k buffers Swap: 8388604k total, 0k used, 8388604k free, 2077988k cached |
Hit the “1” key to see CPU usage by core:
1 2 3 |
1 |
1 2 3 4 5 6 7 8 9 10 |
top - 02:12:59 up 71 days, 19:38, 1 user, load average: 0.29, 0.32, 0.39 Tasks: 101 total, 1 running, 100 sleeping, 0 stopped, 0 zombie Cpu0 : 18.0%us, 3.0%sy, 0.0%ni, 79.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Cpu1 : 0.3%us, 0.7%sy, 0.0%ni, 99.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Cpu2 : 0.0%us, 0.0%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.3%st Cpu3 : 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 4031024k total, 3385624k used, 645400k free, 339668k buffers Swap: 8388604k total, 0k used, 8388604k free, 2078008k cached |
And “q” to exit out:
1 2 3 |
q |
To see a static list of the top 20 CPU-hogging tasks running on your system:
1 2 3 |
# ps -eo pcpu,pid,user,args | sort -k 1 -r | head -20 |
Output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
%CPU PID USER COMMAND 5.2 1388 107 /usr/bin/liquidsoap -d /etc/liquidsoap/bassnoize.liq 4.0 1396 107 /usr/bin/liquidsoap -d /etc/liquidsoap/bassnoize2.liq 2.7 1418 107 /usr/bin/liquidsoap -d /etc/liquidsoap/urban64.liq 2.7 1407 107 /usr/bin/liquidsoap -d /etc/liquidsoap/dnb64.liq 1.5 1378 107 /usr/bin/liquidsoap -d /etc/liquidsoap/bassnoize-other.liq 0.4 7989 www-data /usr/sbin/apache2 -k start 0.4 1937 icecast2 /usr/bin/icecast2 -b -c /etc/icecast2/icecast.xml 0.3 31987 www-data /usr/sbin/apache2 -k start 0.3 31986 www-data /usr/sbin/apache2 -k start 0.3 31985 www-data /usr/sbin/apache2 -k start 0.3 31961 www-data /usr/sbin/apache2 -k start 0.3 31960 www-data /usr/sbin/apache2 -k start 0.3 31796 www-data /usr/sbin/apache2 -k start 0.3 31786 www-data /usr/sbin/apache2 -k start 0.3 1055 mysql /usr/sbin/mysqld 0.1 17887 www-data /usr/sbin/apache2 -k start 0.1 17886 www-data /usr/sbin/apache2 -k start 0.0 9 root [rcuob/0] 0.0 99 root [charger_manager] |
Or to list all tasks with both CPU & RAM usage:
1 2 3 |
ps aux |
For information about your CPU:
1 2 3 |
lscpu |
Output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 4 Core(s) per socket: 1 Socket(s): 1 NUMA node(s): 1 Vendor ID: Xen CPU family: 0 Model: 0 Stepping: 0 CPU MHz: 2266.784 BogoMIPS: 4533.56 Hypervisor vendor: Xen Virtualization type: para NUMA node0 CPU(s): 0-3 |
Check Memory (RAM) Usage
Type the following into your into your shell:
1 2 3 |
# free -m |
The output will look as follows:
1 2 3 4 5 6 |
total used free shared buffers cached Mem: 3936 3321 615 0 329 1969 -/+ buffers/cache: 1022 2913 Swap: 8191 0 8191 |
In my case, I’ve got a total of 4GB of RAM and an 8GB swap file.
Speak Your Mind