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 .
(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