Linux System Monitoring command instance description, linux instance description
Linux System Monitoring
Top Command
Processes: 355 total, 3 running, 352 sleeping, 1540 threads 22:53:50Load Avg: 2.23, 1.85, 1.79 CPU usage: 2.91% user, 3.4% sys, 94.3% idleSharedLibs: 203M resident, 47M data, 29M linkedit.MemRegions: 67938 total, 2480M resident, 96M private, 956M shared.PhysMem: 9029M used (3177M wired), 7345M unused.VM: 995G vsize, 627M framework vsize, 66673141(0) swapins, 67456042(0) swapouts.Networks: packets: 10075546/9110M in, 7870367/1935M out.Disks: 5209393/349G read, 3216109/340G written.PID COMMAND %CPU TIME #TH #WQ #PORT MEM PURG CMPRS PGRP36055 git 0.0 00:00.06 1 0 10 928K 0B 0B 3562636054 git 0.0 00:01.33 2 0 11 7628K 0B 0B 3562636052 mdworker 0.0 00:00.06 4 1 48 5224K 0B 0B 3605236051 mdworker 0.0 00:00.03 3 1 46 2932K 0B 0B 3605136050 mdworker 0.0 00:00.06 4 1 48 8084K 0B 0B 3605036049 top 2.8 00:06.87 1/1 0 25 3400K 0B 0B 3604935964 bash 0.0 00:00.07 1 0 16 2668K 0B 0B 3596435963 login 0.0 00:00.02 2 1 29 1132K 0B 0B 3596335961 Google Chrom 0.0 00:05.98 18 2 156 77M 0B 0B 480435955 git-remote-h 0.1 00:00.29 2 1 37 10M 0B 0B 3562635954 git 0.0 00:00.02 1 0 10 6932K 0B 0B 3562635949 git-remote-h 0.1 00:00.26 2 1 37 4672K+ 0B 0B 3562635948 git 0.0 00:00.01 1 0 10 968K 0B 0B 3562635940 bash 0.0 00:00.00 1 0 8 460K 0B 0B 35626
However, there is another useful tool, glances)
Mac Download Method:
brew install -y glances
Linux Ubuntu:
apt install -y glances
Linux Centos:
yum install -y glances
Pip:
pip install glances
Glances usage:
Directly tap glances on the terminal:
CPU [9.3%] CPU/9.3% nice: 0.0% ctx_sw: 441 MEM-61.2% SWAP-52.6% LOAD 8-core
MEM [61.3%] user: 6.7% inter:-2515 total: 16.0G total: 2.00G 1 min: 1.69
SWAP [52.6%] system: 2.7% sw_int: 446 used: 9.80G used: 1.05G 5 min: 1.72
Idle: 90.7% syscal: 0 free: 6.20G free: 970 M 15 min: 1.73
NETWORK Rx/s Tx/s TASKS 195 (939 thr), 195 run, 0 slp, 0 oth sorted automatically by cpu_percent, flat view
Awdl0 0b 0b
Bridge0 0b 0b CPU % MEM % virt res pid user ni s time + Command
En0 2Kb 864b 39.3 0.7 3.45G 121 M 293 yuqibing 0 R. 56/Applications/Utilities/Terminal.
En1 0b 0b 4.9 0.9 4.21G 155 M 18921 yuqibing 0 R 47: 40.92/Applications/Google Chrome. app/C
En2 0b 0b 2.9 0.1 2.44G 13.1 M 4811 yuqibing 0 R. 99/System/Library/Frameworks/VideoT
Lo0 280b 280b 2.7 0.3 2.41G 43.9 M 38637 yuqibing 0 R 0: 03. 34/Library/Frameworks/Python. framew
P2p0 0b 0b 2.4 1.2 9.44G 190 M 4809 yuqibing 0 R 1h10: 32/Applications/Google Chrome. app/C
Utun0 0b 0b 1.4 1.7 5.19G 276 M 4804 yuqibing 0 R 2h05: 54/Applications/Google Chrome. app/C
Utun1 0b 0b 1.2 0.7 2.96G 115 M 370 yuqibing 0 R. 55/System/Library/Input Methods/SCI
0.5 2.3 4.04G 383 M 19198 yuqibing 0 R. 39/Applications/Google Chrome. app/C
Disk I/O R/s W/s 0.3 0.6 3.63G 103 M 35137 yuqibing 0 R 0: 42. 80/Applications/Google Chrome. app/C
Disk0 494 K 0 0.1 0.2 3.55G 34.1 M 18920 yuqibing 0 R. 87/Applications/Google Chrome. app/C
Disk2 0 0 0.1 0.5 3.70G 83.3 M 18944 yuqibing 0 R. 14/Applications/Google Chrome. app/C
Disk3 0 0 0.1 0.5 3.67G 90.0 M 19058 yuqibing 0 R. 48/Applications/Google Chrome. app/C
0.1 0.1 4.48G 10.1 M 19543 yuqibing 0 R. 79/Library/Java/JavaVirtualMachines
File sys Used Total 0.1 0.2 3.57G 25.7 M 19560 yuqibing 0 R 0: 52. 25/Applications/Google Chrome. app/C
/(Disk1) 115G 233G 0.1 0.6 3.39G 106 M 35625 yuqibing 0 R 0: 01. 54/Applications/Google Chrome. app/C
_ SX-NG-R8 18.0 M 22.4 M 0.0 0.4 2.67G 72.3 M 111 root 0 R. 93/System/Library/CoreServices/logi
_ CCB6B9D7 118G 233G 0.0 0.1 2.41G 13.4 M 278 yuqibing 0 R. 79/usr/sbin/cfprefsd agent
0.0 0.1 2.43G 20.3 M 279 yuqibing 0 R. 77/usr/libexec/UserEventAgent (Aqua
SENSORS 0.0 0.1 2.40G 11.8 M 281 yuqibing 0 R. 90/usr/sbin/distnoted agent
Battery 46% 0.0 0.2 2.45G 25.4 M 283 yuqibing 0 R 0: 49. 88/System/Library/Frameworks/CoreTe
0.0 0.1 2.43G 16.4 M 284 yuqibing 0 R. 73/usr/libexec/lsd
0.0 0.1 3.46G 18.3 M 285 yuqibing 0 R. 30/usr/libexec/trustd -- agent
0.0 0.1 2.42G 13.4 M 289 yuqibing 0 R 0: 06. 44/System/Library/CoreServices/shar
Glances uses several colors to represent the status:
Green: OK (everything works) Blue: CAREFUL (Note) Purple: WARNING (WARNING) Red: CRITICAL (severe)
Glances options:
A-automatically sort processes c-Sort processes by CPU percentage m-Sort processes by memory percentage p-Sort processes by process name in alphabetical order I-Sort processes by read/write frequency (I/ o) process sorting d-display/hide disk I/O statistics f-display/Hide File System statistics n-display/hide Network Interface statistics s-display/hide sensor statistics y-show/hide hardware temperature statistics l-show/hide logs) b-switch network I/O units (Bytes/bits) w-delete warning log x-delete warning and severe log 1-switch global CPU usage and usage of each CPU h-show/hide this help screen t-view the network in combination i/Ou-browse network I/Oq in accumulative form-exit (either 'esc 'or 'ctrl & C)
For more glances options, you can use
See man glances.
Remote use of Glances
glances -sDefine the password for the Glances serverPassword: Password (confirm): Glances server is running on 0.0.0.0:61209
After you run the glances-s command, you will be asked to set a password for the Glances server. After setting, you will see the message "Glances server is running on 0.0.0.0: 61209" (The Glances server is running on port 61209 of 0.0.0.0. After the Glances server is started, run the following command locally to specify the Server IP address or host name as a link.
Note: 172.16.27.56 is the IP address of my Glances server. Glances-c-P 172.16.27.56
The following are some things you must know when using server/client mode:
In server mode, you can use the-B address to set the binding address, or use the-p port to bind the TCP port of the listener to the client mode, you can use the same-p port to specify the default binding address of the server port is 0.0.0.0, but this will listen to the specified ports of all network interfaces in server/client mode, the threshold value is determined by the server setting. You can also use the-P password in the command line to set a password for the server.
Pmap
You can view the memory occupied by the process information based on the process. (You can view the process number in ps:
$ Pmaps-d 5647
Use free in Linux to view memory
$ Free
Total used free shared buffers cached
Mem: 8193564 7868388 325176 0 198848 2645932
-/+ Buffers/cache: 5023608 3169956
Swap: 0 0 0
Rating:
Cat/proc/meminfo
Proc:
/Proc is a pseudo-File System in Linux. It stores a series of special files in the current kernel running status. You can use these files to view information about the system hardware and currently running processes, you can even change the running status of the kernel by changing some files.
/Proc/cpuinfo cpu Information