Several Linux commands for understanding the performance of Linux systems

  
        

Linux systems have some basic commands that can be used for server monitoring.

For a brief introduction, the specific usage can be viewed or consulted by –help
Network: ifconfig, netstat Disk: df CPU:w Process: ps Memory: free I/O: iostat ifconfig< Br>

Enter ifconfig, the output is:

eth0: flags=4163 mtu 1500 inet 10.144.81.226 netmask 255.255.240.0 broadcast 10.144.95.255 ether 00:16:3e:02:04:ba txqueuelen 1000 (Ethernet) RX packets 69775 bytes 91364566 (87.1 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 26057 bytes 1937311 (1.8 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73 mtu 65536 inet 127.0 .0.1 netmask 255.0.0.0 loop txqueuelen 0 (Local Loopback) RX packets 286 bytes 32054 (31.3 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 286 bytes 32054 (31.3 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

The result shows the number of NICs, IP addresses, and MAC addresses of the server. , Where the size of the MTU, the packet transceiver card. ethX (x is 0,1,2……), there are several NICs; inet is the IP address, netmask is the subnet mask, and broadcast is the broadcast address
netstat

netstat Is a command to view network related data,

Active Internet connections (servers and established)Proto Recv-Q Send-Q Local Address Foreign Address State Timertcp 0 0 127.0.0.1:8005 0.0.0.0:* LISTEN off ( 0.$tcp 0 0 0.0.0.0:8009 0.0.0.0:* LISTEN off (0.$tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN off (0.$tcp 0 0 0.0.0.0:8080 0.0 .0.0:* LISTEN off (0.$tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN off (0.$tcp 0 0 115.28.204.58:58433 42.156.166.25:80 ESTABLISHED off (0.$tcp 0 52 115.28.204.58:22 59.71.67.114:21489 ESTABLISHED on (0.4$udp 0 0 115.28.204.58:123 0.0.0. 0:* off (0.$udp 0 0 10.144.81.226:123 0.0.0.0:* off (0.$udp 0 0 127.0.0.1:123 0.0.0.0:* off (0.$udp 0 0 0.0.0.0 :123 0.0.0.0:* off (0.$udp6 0 0 :::123 :::* 

can be used to view all network layer connections on the server.
w

The w command is used to view the load of the server. Enter w and the command output is as follows:

16:59:52 up 4 days, 18:20, 1 user, load Average: 0.09, 0.04, 0.05USER TTY LOGIN@ IDLE JCPU PCPU WHATroot pts/0 16:51 0.00s 0.06s 0.00sw

The result includes the server's runtime (4 days, 18:20), number of users, current The user and its running program, the load average three values ​​are the average load of 1 minute, 5 minutes, 10 minutes.

The system counts the number of tasks currently running in the system and the number of tasks waiting for disk I/O every 5 seconds. The average value is calculated every 1 minute, 5 minutes, and 10 minutes. This value is the average load.
df

The df command is used to view the disk. Enter df -h

Filesystem Size Used Avail Use% Mounted on/dev/xvda1 40G 2.1G 36G 6% /devtmpfs 489M 0 489M 0% /devtmpfs 497M 0 497M 0% /dev/shmtmpfs 497M 19M 478M 4% /runtmpfs 497M 0 497M 0% /sys/fs/cgrouptmpfs 100M 0 100M 0% /run/user/0

Disk usage, directory of mounted disks, etc.
free

free command to view memory status

 total used free shared buffers cachedMem: 1016656 940168 76488 19384 114052 543612-/+ buffers/cache: 282504 734152Swap: 0 0 0

can see the total memory size, used memory and remaining memory.

swap is a swap partition, which can be understood as virtual memory
iostat

io is I/O. This command is used to output I/O related data. Enter iostat -x

Linux 3.10.0-123.9.3.el7.x86_64 (iZ28yqvmjkrZ) 03/20/2016 _x86_64_ (1 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 0.19 0.00 0.13 0.06 0.16 99.47Device: rrqm/s wrqm/sr/sw/s rkB/s wkB/s avgrq-sz avgqu-sz a$xvda 0.00 0.17 0.10 0.33 0.94 5.14 28.83 0.01 2$

Device represents the disk device Data
ps

This command is used to view process information. Enter ps -aux

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMANDroot 1 0.0 0.3 188792 3804 ? Ss Mar15 0:10 /usr/lib/systemd/syste$root 2 0.0 0.0 0 0 ? S Mar15 0:00 [kthreadd]root 3 0.0 0.0 0 0 ? S Mar15 0:01 [ksoftirqd/0]root 5 0.0 0.0 0 0 ? S< Mar15 0:00 [kworker/0:0H]root 7 0.0 0.0 0 0 ? S Mar15 0:00 [migration/0]root 8 0.0 0.0 0 0 ? S Mar15 0:00 [rcu_bh]root 9 0.0 0.0 0 0 ? S Mar15 0:00 [rcuob/0]……

The usage of the process identifier, CPU, memory, etc. can be output.

There are a lot of ps parameters, remember a few commonly used, and then consult the data when there are special needs

Copyright © Windows knowledge All Rights Reserved