Use 'top -i' to see how many processes are in the Running state, there may be memory or I/O bottlenecks in the system, use free to see how much system memory usage, whether swap is occupied a lot, use iostat to see the I/O load... There is also a way to do it ps -ef | sort -k7 to sort the processes by runtime to see which process consumes the most CPU time.
top: Main parameters: d: Specify the update interval, counted in seconds. Q: There are no delayed updates. If the user has a superuser, the top command will be executed with the highest priority. c: Displays the complete path and name of the process. S: Cumulative mode, which accumulates the CPU time of completed or disappeared sub-processes. s: Safe mode. i: No idle or useless (Zombie) processes are displayed. n: Displays the number of updates and exits to when completed Display parameters: PID (Process ID): The process identification number. USER: The username of the person who owns the process. PR: The priority of the process. NI: The priority value of the process. VIRT: The value of the virtual memory occupied by the process. RES: The physical memory value occupied by the process. SHR: The shared memory value used by the process. S: The state of the process, where S means sleeping, R means running, Z means dead, and N means the process priority value is negative. %CPU: The CPU usage used by the process. %MEM: The percentage of physical memory and total memory occupied by the process. TIME+: The total CPU time consumed by the process after it starts. Command: The name of the startup command that the process starts, and if this line is not displayed, the process will have a full command line. During the use of the top command, you can also use some interactive commands to complete the functions of other parameters. These commands are activated via shortcuts. <空格>: Refresh immediately. P: Arranged according to the size of CPU usage. T: Sort according to time and cumulative time. Q: Exit the top command. m: Toggle to display memory information. t: Toggle to display process and CPU status information. c: Toggle to show the command name and the full command line. M: Sort according to the amount of memory used. W: Writes the current settings to the ~/.toprc file. This is the recommended method for writing a top profile.
free 1. Function The free command is used to display the usage of memory, and the usage permission is for all users.
2. Format free [-b-k-m] [-o] [-s delay] [-t] [-V]
3. Main parameters -b -k -m: Displays memory usage in bytes (KB, MB) respectively. -s delay: Shows how many seconds every few seconds to show memory usage. -t: Shows the sum of memory columns. -o: The buffer adjustment column is not displayed.
uptime 18:59:15 up 25 min, 2 users, load average: 1.23, 1.32, 1.21 The time now The time elapsed from the system to the time it has passed The number of users connected The last minute, five, and fifteen minutes of system load Parameters: -V Display version information.
vmstat procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu---- r b swpd free buff cache si so bi bo in cs us sy id wa 0 1 24980 10792 8296 47316 5 19 205 52 1161 698 26 3 1 70 1 Observe disk activity The disk activity is mainly understood from the following indicators: bi: Indicates the number of blocks read per second from disk (blocks/s). The higher the number, the more activity the disk is read. bo: Represents the number of blocks written to disk per second (blocks/s). The higher the number, the more activity is being written to the disk. wa: The proportion of time the CPU waits for disk I/O (pending disk IO). The higher the number, the more severe the file system activity is hindering the CPU as it waits for data to be served by a slow disk system. wa of 0 is ideal. If wa is often greater than 10, the file system may need to be adjusted for performance. 2. Observe CPU activity VMSTAT is a better reflection of CPU usage than top: US: Ratio of the time a user program uses the CPU. The higher this number, the busier the user process. sy: The percentage of time the system calls use the CPU. Note that since NFS runs in the kernel, the CPU time occupied by NFS activities is reflected in sy. If this number is often large, you need to pay attention to whether a kernel process, such as NFS, is more burdensome. If both us and sy are relatively large at the same time, you need to consider separating some user programs to separate servers to avoid affecting each other. id: The percentage of time the CPU is idle. wa: The percentage of time the CPU waits for pending disk IO.
iostat Used to count CPU usage and I/0 amount of tty devices, hard disks, and CD-ROMs Parameters: -c Shows only CPU rows -d Displays disk rows -k Displays disk output in kilobytes -t includes a timestamp in the output -x includes extended disk metrics in the output
avg-cpu: %user %nice %sys %iowait %idle 20.25 0.18 2.61 76.39 0.57 %iowait The percentage of CPU idle time while waiting for local I/O %idle percentage of CPU idle time when local I/O is not waiting
Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn hda 9.86 284.34 84.48 685407 2036 Transfers per second (tps), 512 bytes block reads per second (Blk_read/s), 512 bytes block writes per second (Blk_wrtn/s), and 512 bytes total number of block reads (Blk_read) and writes (Blk_wrtn). system # uname -a # View kernel/OS/CPU information # head -n 1 /etc/issue # Check the OS version # cat /proc/cpuinfo # View CPU information # hostname # View the computer name #lspci -tv # List all PCI devices # lsusb -tv # List all USB devices #lsmod# List the loaded kernel modules # env # Look at environment variables Resources # free -m # View memory usage and swap area usage # df -h # View the usage of each partition # du -sh # to see the size of the specified directory # grep MemTotal /proc/meminfo # View the total amount of memory # grep MemFree /proc/meminfo # Check the amount of free memory # uptime # View system running time, number of users, load # cat /proc/loadavg # to see the system load Disks and partitions # mount | column -t # to view the status of the mounted partition # fdisk -l # See all partitions #swapon -s # See all swap partitions # hdparm -i /dev/hda # View disk parameters (IDE devices only) # dmesg | grep IDE # Check the IDE device detection status at startup Internet #ifconfig # View the properties of all network interfaces #iptables -L # Look at the firewall settings # route -n # Look at the routing table # netstat -lntp # See all listening ports #netstat -antp # to see all connections that have been established #netstat -s # View network statistics process # ps -ef # See all processes # top # Show the process status in real time user # w # View active users # id # View the specified user information # last # View user login logs # cut -d: -f1 /etc/passwd # See all users on the system # cut -d: -f1 /etc/group # See all groups in the system # crontab -l # to see the current user's scheduled tasks service # chkconfig --list # List all system services # chkconfig --list | grep on # lists all started system services Procedure #rpm-qa # See all installed packages |