One linux command every day (44): top Command

Source: Internet
Author: User
Tags touch command
Every day, a linux command (44): top command link: A linux command (1): ls command http://www.2cto.com/ OS /201210/163049.html#linuxlinuxcommand (2): cd command restart ..
One linux command every day (44): top Command

Related links:
One linux command every day (1): ls command
Http://www.2cto.com/ OS /201210/163049.html;
One linux command every day (2): cd command
Http://www.2cto.com/ OS /201210/163050.html;
One linux command every day (3): pwd command
Http://www.2cto.com/ OS /201210/16.02.html;
One linux command every day (4): mkdir command
Http://www.2cto.com/ OS /201210/163163.html;
One linux command every day (5): rm command
Http://www.2cto.com/ OS /201210/16.02.html;
One linux command (6) every day: rmdir command
Http://www.2cto.com/ OS /201210/164017.html;
One linux command (7) every day: mv command
Http://www.2cto.com/ OS /201210/16.07.html;
One linux command every day (8): cp command
Http://www.2cto.com/ OS /201210/163164.html;
One linux command every day (9): touch Command
Http://www.2cto.com/ OS /201211/165699.html;
One linux command every day (10): cat command
Http://www.2cto.com/ OS /201211/165989.html;
One linux command every day (11): nl command
Http://www.2cto.com/ OS /201211/165990.html
One linux command every day (12): more command
Http://www.2cto.com/ OS /201211/165994.html
One linux command every day (13): less command
Http://www.2cto.com/ OS /201211/165998.html
One linux command every day (14): head Command
Http://www.2cto.com/ OS /201211/166191.html
One linux command every day (15): tail command
Http://www.2cto.com/ OS /201211/168702.html
One linux command every day (16): which command
Http://www.2cto.com/ OS /201211/168890.html
A linux command (17) every day: whereis command
Http://www.2cto.com/ OS /201211/168893.html
One linux command (18) every day: locate command
Http://www.2cto.com/ OS /201211/168895.html
One linux command every day (19): find command overview
Http://www.2cto.com/ OS /201211/168897.html
One linux command every day (20): find command exec
Http://www.2cto.com/ OS /201211/168901.html
One linux command (21) every day: find command xargs
Http://www.2cto.com/ OS /201211/168903.html
A linux command (22) every day: detailed description of the parameters of the find Command
Http://www.2cto.com/ OS /201211/168912.html
A linux command (23) every day: Linux directory structure
Http://www.2cto.com/ OS /201211/170430.html
One linux command every day (24): Linux file type and extension
Http://www.2cto.com/ OS /201211/170431.html
One linux command every day (25): Explanation of linux file attributes
Http://www.2cto.com/ OS /201211/170434.html
One linux command every day (26): use SecureCRT to upload and download files
Http://www.2cto.com/ OS /201211/172022.html
One linux command every day (27): linux chmod command
Http://www.2cto.com/ OS /201211/172028.html
One linux command every day (28): tar command
Http://www.2cto.com/ OS /201212/172641.html
One linux command (29) every day: chgrp command
Http://www.2cto.com/ OS /201212/172983.html
One linux command every day (30): chown command
Http://www.2cto.com/ OS /201212/173239.html
A linux command (31) every day:/etc/group file details
Http://www.2cto.com/ OS /201212/174429.html
One linux command (32) every day: gzip command
Http://www.2cto.com/ OS /201212/174431.html
One linux command every day (33): df command
Http://www.2cto.com/ OS /201212/174434.html
One linux command every day (34): du command
Http://www.2cto.com/ OS /201212/174701.html
One linux command (35) every day: ln command
Http://www.2cto.com/ OS /201212/174993.html
One linux command (36) every day: diff command
Http://www.2cto.com/ OS /201212/176333.html
One linux command (37) every day: date Command
Http://www.2cto.com/ OS /201212/176335.html
One linux command (38) every day: cal command
Http://www.2cto.com/ OS /201212/176337.html
One linux command (39) every day: grep command
Http://www.2cto.com/ OS /201212/177059.html
One linux command every day (40): wc command
Http://www.2cto.com/ OS /201212/177343.html
One linux command every day (41): ps command
Http://www.2cto.com/ OS /201212/177665.html
One linux command every day (42): kill Command
Http://www.2cto.com/ OS /201212/177686.html
One linux command every day (43): killall command
Http://www.2cto.com/ OS /201212/178264.html top command is a common performance analysis tool in Linux, which can display the resource usage of various processes in the system in real time, similar to the Windows Task Manager. The following describes how to use it. Top is a dynamic display process. you can press the buttons to refresh the current status. if you execute this command on the foreground, it excludes the foreground until the user terminates the program. more accurately, the top command provides real-time monitoring of the status of the system processor. it displays the list of CPU-sensitive tasks in the system. this command can be used by CPU. the memory usage and execution time are used to sort tasks. many features of this command can be set through interactive commands or in a custom file. www.2cto. com1. command format: top [parameter] 2. command: displays information about the processes being executed by the system, including the process ID, memory usage, and CPU usage. command parameters:-B batch processing-c display complete governance command-I ignore invalidation process-s confidentiality Mode-S accumulation mode-I <时间> Set the interval-u <用户名> Specify username-p <进程号> Process-n <次数> Number of cycles 4. use instance: instance 1: Display process information command: top output: [root @ TG1704 log] # toptop-14:06:23 up 70 days, 2 users, load average: 1.25, 1.32, 1.35 Tasks: 206 total, 1 running, 205 sleeping, 0 stopped, 0 zombieCpu (s): 5.9% us, 3.4% sy, 0.0% ni, 90.4% id, 0.0% wa, 0.0% hi, 0.2% si, 0.0% stMem: 32949016 k total, 14411180 k used, 18537836 k free, 169884 k buffersSwap: 32764556 k total, 0 k used, 32764556 k free, 3612636 k cached PID US Er pr ni virt res shr s % CPU % mem time + COMMAND28894 root 22 0 1501 m 405 m 10 m S 52.2 1.3 2534: 16 java18249 root 18 0 3201 m 1.9g 11 m S 35.9 6.0 569: 39.41 java2808 root 25 0 3333 m 1.0g 11 m S 24.3 3.1 526: 51.85 java25668 root 23 0 3180 m 704 m 11 m S 14.0 2.2 360: 44.53 java574 root 25 0 3168 m 611 m 10 m S 12.6 1.9 556: 59.63 java1599 root 20 0 3237 m 1.9g 11 m S 12.3 6.2 262: 01.14 java1008 root 21 0 3147 m 84 2 m 10 m S 0.3 2.6. 08 java13823 root 23 0 3031 m 2.1g 10 m S 0.3 6.8 176: 57.34 java28218 root 15 0 12760 1168 808 R 0.3 0.0. 43 top29062 root 20 0 1241 m 227 m 10 m S 0.3. 32 java1 root 15 0 10368 684 S 572 0.0. 85 init2 root RT-5 0 0 0 S 0.0 0.0. 01 migration/03 root 34 19 0 0 0 S 0.0 0.0. 00 ksoftirqd/04 root RT-5 0 0 0 S 0.0 0.0. 00 watchdog/05 root RT-5 0 0 0 S 0.0 0.0. 80 migration/16 root 34 19 0 0 S 0.0 0.0. 00 ksoftirqd/17 root RT-5 0 0 0 S 0.0 0.0. 00 watchdog/18 root RT-5 0 0 0 S 0.0 0: 20. 59 migration/29 root 34 19 0 0 S 0.0 0.0. 09 ksoftirqd/210 root RT-5 0 0 0 S 0.0 0: 00. 00 watchdog/211 root RT-5 0 0 0 S 0.0 0: 23. 66 migration/312 root 34 19 0 0 0 S 0.0 0.0. 03 ksoftirqd/313 root RT-5 0 0 0 S 0.0 0.0. 00 watchdog/314 root RT-5 0 0 0 S 0.0 0: 20. 29 migration/415 root 34 19 0 0 S 0.0 0.0. 07 ksoftirqd/416 root RT-5 0 0 0 S 0.0 0.0. 00 watchdog/417 root RT-5 0 0 0 S 0.0 0: 23. 07 migration/518 root 34 19 0 0 0 S 0.0 0.0. 07 ksoftirqd/519 root RT-5 0 0 0 S 0.0 0.0. 00 watchdog/520 root RT-5 0 0 0 S 0.0 0: 17. 16 migration/621 root 34 19 0 0 S 0.0 0.0. 05 ksoftirq D/622 root RT-5 0 0 0 S 0.0 0: 00. 00 watchdog/623 root RT-5 0 0 0 S 0.0 0: 58. 28 migration/7 note: statistical information area: the first five lines are the overall statistical information area of the current system. Next we will look at the specific meaning of each line of information. The first line is the task queue information, which is the same as the execution result of the uptime Command. the specific parameters are described as follows: 14: 06: 23-the current system time is up for 70 days, -The system has been running for 70 days, 16 hours, and 44 minutes (during this period, the system has not restarted the CRASH !) 2 users-currently there are two users logging on to the system load average: 1.15, 1.42, 1.44-load average. The three numbers after the average are 1 minute, 5 minutes, and 15 minutes respectively. The load average data checks the number of active processes every five seconds and then calculates the value based on a specific algorithm. If this number is divided by the number of logical CPUs, the system is overloaded when the result is higher than 5. The second line is Tasks-task (process). The details are described as follows: the system currently has 206 processes, of which 1 is running and 205 are sleep ), there are 0 stoped States and 0 zombie states (botnets. The third line shows the cpu status information. the specific attributes are described as follows: 5.9% us-percentage of CPU occupied by user space. 3.4% sy-percentage of CPU occupied by kernel space. 0.0% ni-percentage of CPU used by processes that have changed their priorities 90.4% id-percentage of idle CPU 0.0% wa-IO percentage of CPU occupied 0.0% hi-hard interrupt (Hardware IRQ) CPU usage 0.2% si-soft interrupt (Software Interrupts) CPU usage percentage remarks: here the CPU usage rate is different from the windows concept, understanding about linux user space and kernel space! Row 4: Memory status. Details: 32949016 k total-total physical memory (32 GB) 14411180 k used-total memory in use (14 GB) 18537836 k free-total idle memory (18 GB) 169884 k buffers-cache memory (169 MB) the fifth line, swap partition information, details are described as follows: 32764556 k total-total swap areas (32 GB) 0 k used-total number of swap areas used (0 K) 32764556 k free-total number of idle swap areas (32 GB) 3612636 k cached-buffer swap zone total (3.6 GB) remarks: the total memory used in row 4 refers to the number of memories currently controlled by the system kernel, the total idle memory (free) is the number of cores not included in the control scope. The memory included in the kernel management is not always in use, but also the memory that can be reused in the past, the kernel does not return the reusable memory to free. therefore, free memory will become fewer and fewer on linux, but you don't have to worry about it. If you calculate the number of available memory out of habit, there is an approximate formula: free in the fourth row + buffers in the fourth row + cached in the fifth row, according to this formula, the available memory of this server is about 18537836 k + 169884 k + 3612636 k = 22 GB. For memory monitoring, we need to monitor the used of the fifth-line swap partition in top. if this value is constantly changing, it means that the kernel is constantly exchanging data between memory and swap, this is the real insufficient memory. The sixth line is empty. The seventh line is the status monitoring of each process (task). the Project column information is described as follows: PID-process idUSER-process owner PR-process priority NI-nice value. A negative value indicates a high priority. a positive value indicates a low priority VIRT-total virtual memory used by the process, in kb. VIRT = SWAP + RESRES-physical memory used by the process, not swapped out, in kb. RES = CODE + DATASHR-shared memory size, in kbS-process status. D = non-disruptive sleep state R = Running S = sleep T = tracking/stopping Z = Zombie process % CPU-percentage of CPU time occupied since the last update % MEM-process used physical memory percentage TIME +-total cpu time used by the process, unit: 1/100 seconds COMMAND-process name (COMMAND name/COMMAND line) other tips: 1. multi-U multi-core CPU monitoring in the top basic view, press the keyboard number "1" to monitor the status of each logical CPU: observe that the server has 16 logical CPUs, actually four physical CPUs. Press the number key 1 to return to the top basic view interface. 2. highlight the current running process and press "B" on the keyboard (enable/disable the highlighted effect). The top view changes as follows: we find that the "top" process with the process id of 2570 is highlighted, the top process is the only runing process displayed on the second line of the view. you can press the "y" key to close or enable the brightening effect of the running process. 3. by default, process fields are sorted by CPU usage. java processes with a process ID of 28894 rank first (cpu usage of 142% ), java processes with a process ID of 574 rank second (cpu usage: 16% ). Press "x" on the keyboard (enable or disable the highlight effect of the sorting column). The top view changes as follows: you can see that the top default sorting column is "% CPU ". 4. you can use "shift +>" or "shift + <" to change the order column to the right or left by "shift +>". The View is now sorted by % MEM. Instance 2: Display complete command: top-c output: Note: instance 3: Display program information in batch mode command: top-B output: Note: instance 4: run the "top-S output" command to display program information in the accumulative mode. note: instance 5: set the number of information updates. run the command "top-n 2". the output is described as follows: indicates to terminate the update display instance after two updates 6: Set the information update time command: top-d 3 output: Note: indicates that the update cycle is 3 seconds for instance 7: command: top-p 574 output: Description: 5. some interactive commands that can be used during top command execution. These commands are single-letter. if the s option is used in the command line, some of these commands may be blocked. H. The help screen is displayed, and some brief command summaries are provided to explain that k terminates a process. I ignore idle and dead processes. This is a switch-on command. Q exit program r reschedule the priority S of a process to switch to the cumulative Mode s to change the delay time between two refreshes (unit: s). if there is a decimal number, it is converted to m s. If the input value is 0, the system will continue to refresh, the default value is 5 sf or F. add or delete a project from the current display. o or O changes. display the order of items. l switch. display average load and start time. m switch. display memory information. t switch. display process. and CPU status information c Switch display command name and complete command line M sort by resident memory size P sort by CPU usage percentage T sort by time/accumulative time W set the current write ~ /. Toprc file
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.