Linux Common Commands-top

Source: Internet
Author: User

Linux Common Commands-top

The top command displays the status of the process in real time. The default state shows CPU-intensive processes and is updated every 5 seconds . You can use the digital size of the PID, age (), time (), Resident memory usage (), and how long the process consumes the CPU from the start.

Top-20:59:18 up 4 days, 4:47, 1 user, Load average:0.00, 0.00, 0.00TASKS:65 Total, 2 running, sleeping, 0   Stopped, 0 zombiecpu (s): 0.2%us, 0.1%sy, 0.0%ni, 99.6%id, 0.1%wa, 0.0%hi, 0.0%si, 0.0%stmem:500472k Total, 282756k used, 217716k free, 82496k buffers swap:0k total, 0k used, 0k free, 61052k cached                                                                 PID USER PR NI VIRT RES SHR S%cpu%MEM time+ COMMAND                                                                975 Root 0 756m 10m 8008 S 0.2 2.1 9:12.19 Aliyundun                                                                  991 Root 0 768m 9320 7164 S 0.2 1.9 5:19.35 Alihids                                                            842 Root 0 463m 2588 1888 S 0.1 0.5 2:43.88 aliyundunupdate                                            1 root 0 19232 1512 1224 S 0.0 0.3 0:00.65 Init                           2 Root 0 0 0 0 S 0.0 0.0 0:00.01 Kthreadd                                                                3 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0                                                                4 Root 0 0 0 0 S 0.0 0.0 0:00.71 ksoftirqd/0 5 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migratio n/0 6 root RT 0 0 0 0 S 0.0 0.0 0:00.5 5 watchdog/0 7 Root 0 0 0 0 S 0.0 0. 0 0:12.40 events/0 8 root 20 0 0 0 0    S 0.0 0.0 0:00.00 cgroup 9 root 20 0 0   0 0 S 0.0 0.00:00.00 khelper Root 0 0 0 0 S 0     .0 0.0 0:00.00 netns root 20 0 0 0     0 S 0.0 0.0 0:00.00 async/mgr Root 20 0      0 0 0 S 0.0 0.0 0:00.00 pm Root                                                                  0 0 0 0 S 0.0 0.0 0:00.00 Xenwatch                                                                    Root 0 0 0 0 S 0.0 0.0 0:00.00 Xenbus                                                               Root 0 0 0 0 S 0.0 0.0 0:01.22 sync_supers                                                         Root 0 0 0 0 S 0.0 0.0 0:01.14 Bdi-default      Root 0 0 0 0 S 0.0 0.0 0:00.00 kintegrityd/0                                                                 Root 0 0 0 0 S 0.0 0.0 0:00.18 kblockd/0                                                                    Root 0 0 0 0 S 0.0 0.0 0:00.00 kacpid                                                              Root 0 0 0 0 S 0.0 0.0 0:00.00 kacpi_notify   Root 0 0 0 0 S 0.0 0.0 0:00.00 kacpi_hotplug

If you want to increase the priority of a process, you can pass commands renice if you have a process that consumes too much CPU resources kill .

    • Top displays the meanings of each column that appears:

      PID: Process Descriptor
      User: owner of the process
      PRI: priority of the process
      NI: nice level
      SIZE: process-owned memory (includes code segment + data segment + stack segment)
      RSS: Physical Memory usage
      VIRT(Virtul memory usage): The amount of virtual memory the process requires
      RES (Resident memory usage): Resident RAM
      SHARE: Physical memory space shared with other processes
      STAT: The state of the process, with s=sleeping,r=running,t=stopped or traced,d=interruptible sleep ( non-disruptive sleeping state ), z= Zombie
      %cpu: CPU usage
      %MEM: Use of physical memory
      Time : Total CPU elapsed by the process
      Command : commands for the process

    • Common commands:

(1) T: Used to show the total statistics, that is, the following two lines

Tasks:  65 total,   2 running,  63 sleeping,   0 stopped,   0 zombieCpu(s):  0.2%us,  0.1%sy,  0.0%ni, 99.6%id,  0.1%wa,  0.0%hi,  0.0%si,  0.0%st

(2)m: Whether the user displays memory information, which is the following two lines

Mem:    500472k total,   282756k used,   217716k free,    82496k buffers    Swap:        0k total,        0k used,        0k free,    61052k cached

(3)a: According to a single window to switch to a multi-window, you can see four different windows, you can use A or W to switch multiple windows. The names of the four windows were:def,job,mem,usr

(4)F: into a dynamic configuration top screen, you can configure the top according to your preference

(5)o: sort the existing configuration of top (order)

(6)R: using the Renice command

(7)K: Use the KILL command

    • How to use the top command line

(1) Batch processing mode

Plus -b , when top is displayed, the results of each display are printed out, and the last result is not flushed out.

(2) Display information for a process

$ top -p pid

If it is multiple processes, as follows:

$ top -p pid1,pid2,pid3

(3) Displaying process information for a user

$ top -u username

(4) Displaying thread information, not process information

(5) Set the time of the brush screen (in s)

$ top -d ntime

Linux common Commands-top

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.