Command for viewing system resource usage in Linux

Source: Internet
Author: User
In Linux, use the Command & amp; #39; top-I & amp; #39; to view how many processes are Running, there may be a memory or I/O bottleneck in the system. use free to check whether the system memory usage is high. use iostat to check whether swap is occupied...
Run the 'top-I 'command to check system resource usage in Linux to check how many processes are Running. the system may have memory or I/O bottlenecks, use free to check the system memory usage and whether swap is used up. use iostat to check the I/O load... another method is ps-ef | sort-k7, which sorts processes by running time and determines which process consumes the most cpu time. Www.2cto.com ======================================== top main parameter d: specifies the update interval, in seconds. Q: There are no delayed updates. If a super user exists, the top command is executed in the highest priority order. C: displays the complete process path and name. S: the accumulation mode, which accumulates the CPU time of the completed or disappearing sub-itinerary. S: security mode. I: No Idle (Idle) or useless (Zombie) itinerary is displayed. N: displays the number of updates. after the update is completed, the system will exit to display the parameter PID (Process ID): Process ID. USER: the USER name of the process owner. PR: process priority. NI: the priority value of the process. VIRT: virtual memory occupied by the process. RES: the physical memory occupied by the process. SHR: the shared memory value used by the process. S: Process Status. S indicates sleep, R indicates running, Z indicates frozen, and N indicates that the priority of the process is negative. % CPU: CPU usage occupied by the process. % MEM: Percentage of physical memory and total memory occupied by the process. TIME +: The total cpu time occupied by the process after it is started. Command: The name of the startup Command that the process starts. if this line does not appear, the process has a complete Command line. Some interactive commands can be used to complete other parameter functions during the use of the top command. These commands are started by using the shortcut key. <空格> : Refresh immediately. P: Sort by CPU usage. T: Sort by time and accumulated time. Q: exit the top command. M: Switch to display memory information. T: Process and CPU status information is displayed during switchover. C: switch the display command name and the complete command line. M: Sort by memory size. W: write the current settings ~ /. Toprc file. This is a recommended method for writing top configuration files. ============================================== Free 1. the free command is used to display the memory usage. The permission is applied to all users. 2. format: free [-B-k-m] [-o] [-s delay] [-t] [-V] 3. main parameter-B-k-m: memory usage is displayed in bytes (KB, MB. -S delay: the number of seconds to display the memory usage. -T: displays the total memory column. -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 current time/system start time after running/number of connected users/last minute, five-minute and fifteen-minute system load parameters:-V displays 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 st 0 0 168 6291888 901268 0 0 0 9 1 1 1 98 0 01 observe disk activity mainly from the following indicators: bi: the number of blocks read from the disk per second (blocks/s ). The larger the number, the more disk read activity. Bo: the number of blocks written to the disk per second (blocks/s ). The larger the number, the more disk write activity. Wa: percentage of time when the cpu waits for disk I/O (pending disk IO. The larger the number, the more serious the file system activity hinders the cpu, because the cpu is waiting for the slow disk system to provide data. It is ideal to set wa to 0. If wa is often greater than 10, the file system may need to adjust its performance. 2. observe cpu activity. vmstat is more likely to reflect cpu usage than top: us: the cpu usage time ratio of your program. The larger the number, the busier the user process. Sy: cpu usage time ratio for system calls. Note that NFS runs in the kernel, so the cpu time occupied by NFS activity is reflected in sy. If this number is large, you need to consider whether a kernel process is heavy, for example, NFS tasks. If both us and sy are large, you need to consider separating some user programs from other servers to avoid mutual influence. Id: Percentage of idle cpu time. Wa: percentage of time when the cpu waits for pending disk IO. Iostat is used to count CPU usage and I/0 parameters for tty devices, hard disks, and CD-ROM: -c: only display CPU rows-d: Display disk rows-k: Display disk output in kilobytes-t: Include timestamp in output-x include extended disk metrics avg- cpu: % user % nice % sys % iowait % idle 20.25 0.18 2.61 76.39 percentage of CPU idle time when iowait waits for local I/O % idle does not wait for local I/O CPU idle time % Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn hda 9.86 284.34 84.48 685407 2036 transmission per second (tps), 512 bytes read per second (Blk_read/s), 512 bytes per second (Blk_wrtn/s), 512 bytes read (Blk_read), and write (Total number of Blk_wrtn. ==================================================== Www.2cto.com system # uname-a # View kernel/OS/CPU information # head-n 1/etc/issue # View OS version # cat/proc/cpuinfo # View CPU information # hostname # view Computer Name # lspci-TV # List all PCI devices # lsusb-TV # List all USB devices # lsmod # List loaded kernel modules # env # View environment variables ==== ==================================== resource # free-m # View memory usage and swap zone usage # df-h # view the usage of each partition # du-sh # view the size of the specified directory # grep MemTotal/proc/meminfo # view the total memory # grep MemFree/ proc/meminfo # view the amount of idle memory # uptime # view the system running time, number of users, and load # cat/proc/loadavg # view the system load ========== ============================== disk and partition # mount | column-t # View attached partition status # fdisk-l # View All partitions # swapon-s # View all swap partitions # hdparm-I/dev/hda # View disk parameters (only applicable to IDE devices) # dmesg | grep IDE # view the IDE device detection status at startup ====================== ============ network # ifconfig # view the attributes of all network interfaces # iptables-L # View firewall settings # route-n # View route tables # netstat-lntp # View all listening ports # netstat-antp # View all established connections # netstat-s # View network statistics ============ ==================================== process # ps-ef # View all processes # top # Display process status in real time = ============================================== user # w # viewing active users # id # viewing specified user information # last # viewing user logon logs # cut-d: -f1/etc/passwd # View all users in the system # cut-d: -f1/etc/group # View all groups of the system # crontab-l # view the scheduled tasks of the current user ================== ============================== service # chkconfig -- list # list all system Services # chkconfig -- list | grep on # list all started system service =================================================== = program # rpm-qa # View all installed software
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.