Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Top command: the Task Manager under linux     - C ++ Supplements - References (Lvalue Reference, Rvalue Reference) (Linux)

- How to enable fbcon in Debian (Linux)

- Linux dual physical network card set to a virtual NIC (Linux)

- ASP.NET 5 is connected with the Redis server on the Linux platform (Server)

- Python 3.5 await / async (Programming)

- Python, and / or (Programming)

- Hadoop + Zookeeper NameNode achieve high availability (Server)

- Linux kernel RCU (Read Copy Update) lock Brief - prequel (Linux)

- Reason C ++ program running under Linux a segmentation fault core dumped in (Programming)

- Linux terminal interface font color settings (Linux)

- CentOS 7 open ports (Linux)

- Recycle Bin function realization in Linux (Linux)

- LNMP summary of the issues common 502 Bad Gateway (Server)

- Deploy the project to the server from GitHub (Server)

- RHEL7 system making use of OpenStack mirror (Linux)

- MySQL binlog group to submit XA (two-phase commit) (Database)

- MySQL5.7.10 installation documentation (Database)

- Teach you how to protect the security of Linux desktop (Linux)

- Linux alpine use the command line to access Gmail (Linux)

- Let VMware ESXi virtual switch support VLAN (Linux)

 
         
  Top command: the Task Manager under linux
     
  Add Date : 2018-11-21      
         
         
         
  Top command is commonly used under Linux performance analysis tools, real-time display system resource usage status of each process, similar to Windows Task Manager. top is a dynamic display of process, that can be constantly refreshed by the user key to the current state. If you execute the command in the foreground, it will monopolize the front desk until the user terminates the program so far. more accurate to say, top command provides a real-time system the processor will display the status of the monitoring system CPU the most "sensitive" task list command can use CPU memory usage and execution time on the task sort;.. and many of the features of the order are available through an interactive command or set in the personal customization file.

$ Top
    top - 09:14:56 up 264 days, 20:56, 1 user, load average: 0.02, 0.04, 0.00
    Tasks: 87 total, 1 running, 86 sleeping, 0 stopped, 0 zombie
    Cpu (s): 0.0% us, 0.2% sy, 0.0% ni, 99.7% id, 0.0% wa, 0.0% hi, 0.0% si, 0.2% st
    Mem: 377672k total, 322332k used, 55340k free, 32592k buffers
    Swap: 397308k total, 67192k used, 330116k free, 71900k cached
    PID USER PR NI VIRT RES SHR S% CPU% MEM TIME + COMMAND
    1 root 20 0 2856 656 388 S 0.0 0.2 0: 49.40 init
    2 root 20 0 0 0 0 S 0.0 0.0 0: 00.00 kthreadd
    3 root 20 0 0 0 0 S 0.0 0.0 7: 15.20 ksoftirqd / 0
    4 root RT 0 0 0 0 S 0.0 0.0 0: 00.00 migration / 0
first row
09:14:56: current time
264 days, 20:56: system boot to now how much time
1 users: 2 Users currently online
load average: 0.02, 0.04, 0.00: System 1 minute, 5 minutes, 15 minutes of CPU load information
second line
Tasks: Task;
87 total: well understood, is currently 87 tasks, which is 87 processes.
1 running: 1 processes running
86 sleeping: 86 processes sleep
0 stopped: Stop number of processes
0 zombie: zombie number of processes
The third row
Cpu (s): This line indicates the overall display CPU information
0.0% us: user mode process CPU percentage of time does not include CPU time renice value is negative task occupied.
0.7% sy: kernel occupancy percentage of CPU time
0.0% ni: percentage change over the priority of the process CPU
99.3% id: idle CPU time percentage
0.0% wa: waiting for I / O percentage of CPU time
0.0% hi: CPU hardware interrupt percentage of time
0.0% si: CPU soft interrupt time percentage
Note: The data shown here is the average of all the cpu, cpu if you want to see each of the handling, you can press 1; fold, press 1 again;
Fourth row
Men: memory means
8175320kk total: total physical memory
8058868k used: the amount of physical memory used
116452k free: the amount of physical memory free
283084k buffers: the amount of physical memory for the kernel cache
Fifth row
Swap: Swap Space
6881272k total: total swap
4010444k used: the amount used swap
2870828k free: the amount of swap free zone
4336992k cached: Total swap buffer zone
Process Information
Here again is the process information:
PID: Process ID
USER: Process owners
PR: priority process, the smaller the priority is executed
NInice: Value
VIRT: virtual memory occupied by the process
RES: process of physical memory
SHR: process uses shared memory
S: state of the process. S indicates sleep, R for running, Z represents a dead state, N represents the process priority value is negative
% CPU: process CPU usage
% MEM: The percentage of physical memory and the total memory used by the process
TIME +: Total CPU time the process started occupation that takes up CPU time accumulated value.
COMMAND: Process startup command name
8.1. Top command interworking instructions

Here are some commonly used commands top command operation

q: quit the top command
: Refresh Now
s: set the refresh interval
c: Displays the command mode completely
t :: show or hide processes and CPU status information
m: Show or hide the memory status information
l: show or hide uptime information
f: increase or decrease the process display flag
S: accumulation mode, it will have been completed or exit the sub-process CPU time accumulated to the parent process MITE +
P: Press% CPU usage ranking
T: Press MITE + Ranking
M: Press% MEM Ranking
u: Specifies that user process
r: renice value revision process
kkill: Process
i: Shows only processes running
W: Save the settings to a file on top ^ / toprc, it will automatically call the next time you start setting toprc file.
h: help command.
q: Quit
Note: to emphasize that the most frequently used is P, T, M, because usually use top, we wanted to see which processes are consuming the most cpu resources, the memory maximum; Note: The "shift +>" or "shift + < "to the right or left to change the sort column if you only want to view the memory: available free command. See only uptime information (first row), available uptime command;

8.2. Examples

Example 1: Multicore CPU monitoring

In the top basic view, press the keypad number "1", can monitor the status of each logical CPU;

[Linux @ linuxhost ^] $ top
top - 09:10:44 up 20 days, 16:51, 4 users, load average: 3.82, 4.40, 4.40
Tasks: 1201 total, 10 running, 1189 sleeping, 0 stopped, 2 zombie
Cpu0: 1.3% us, 2.3% sy, 0.0% ni, 96.4% id, 0.0% wa, 0.0% hi, 0.0% si, 0.0% st
Cpu1: 1.3% us, 2.6% sy, 0.0% ni, 96.1% id, 0.0% wa, 0.0% hi, 0.0% si, 0.0% st
Cpu2: 1.0% us, 2.0% sy, 0.0% ni, 92.5% id, 0.0% wa, 0.0% hi, 4.6% si, 0.0% st
Cpu3: 3.9% us, 7.8% sy, 0.0% ni, 83.2% id, 0.0% wa, 0.0% hi, 5.2% si, 0.0% st
Cpu4: 4.2% us, 10.4% sy, 0.0% ni, 63.8% id, 0.0% wa, 0.0% hi, 21.5% si, 0.0% st
Cpu5: 6.8% us, 12.7% sy, 0.0% ni, 80.5% id, 0.0% wa, 0.0% hi, 0.0% si, 0.0% st
Cpu6: 2.9% us, 7.2% sy, 0.0% ni, 85.3% id, 0.0% wa, 0.0% hi, 4.6% si, 0.0% st
Cpu7: 6.2% us, 13.0% sy, 0.0% ni, 75.3% id, 0.0% wa, 0.0% hi, 5.5% si, 0.0% st
Mem: 32943888k total, 32834216k used, 109672k free, 642704k buffers
Swap: 35651576k total, 5761928k used, 29889648k free, 16611500k cached
Example 2: Highlight the current running process

In the top basic view, press the keyboard "b" (Open / Close highlighting effect);
Example 3: display the full command

Command: top -c

[Linux @ linuxhost ^] $ top -c
top - 09:14:35 up 20 days, 16:55, 4 users, load average: 5.77, 5.01, 4.64
Tasks: 1200 total, 5 running, 1192 sleeping, 0 stopped, 3 zombie
Cpu (s): 4.4% us, 6.0% sy, 0.0% ni, 83.8% id, 0.2% wa, 0.0% hi, 5.5% si, 0.0% st
Mem: 32943888k total, 32842896k used, 100992k free, 591484k buffers
Swap: 35651576k total, 5761808k used, 29889768k free, 16918824k cached
PID USER PR NI VIRT RES SHR S% CPU% MEM TIME + COMMAND
2013 apache 18 0 403m 88m 5304 S 25.0 0.3 6: 37.44 / usr / sbin / httpd
18335 pubtest 22 0 65576 996 728 R 7.8 0.0 0: 00.24 netstat -naltp
16499 rdtfare 15 0 13672 2080 824 R 2.6 0.0 0: 00.38 top -c
29684 rdtfare 15 0 1164m 837m 14m S 2.3 2.6 148: 47.54 ./autodata data1.txt
12976 pubtest 18 0 238m 9000 1932 S 1.6 0.0 439: 28.44 tscagent -s TOEV_P
Example 4: Displays process information

Command: top -p pidid

/ Opt / app / tdv1 / config # top -p 17265
top - 09:17:34 up 455 days, 17:55, 2 users, load average: 3.76, 4.56, 4.46
Tasks: 1 total, 0 running, 1 sleeping, 0 stopped, 0 zombie
Cpu (s): 7.8% us, 1.9% sy, 0.0% ni, 89.2% id, 0.0% wa, 0.1% hi, 1.0% si, 0.0% st
Mem: 8175452k total, 8103988k used, 71464k free, 268716k buffers
Swap: 6881272k total, 4275424k used, 2605848k free, 6338184k cached
PID USER PR NI VIRT RES SHR S% CPU% MEM TIME + COMMAND
17265 tdv1 15 0 56504 828 632 S 0.0 0.0 195: 53.25 redis-server
A plurality of information specified process, the need to combine other tools will replace the carriage return, (- p support pid, pid, pid grammar)

Command: top -p pgrep MULTI_PROCESS | tr "\ n" "," | sed 's /, $ //'

/ Opt / app / tdv1 $ top -p `pgrep java | tr" \\ n "", "| sed 's /, $ //'`
top - 14:05:31 up 53 days, 2:43, 9 users, load average: 0.29, 0.34, 0.22
Tasks: 3 total, 0 running, 3 sleeping, 0 stopped, 0 zombie
Cpu (s): 5.9% us, 8.2% sy, 0.0% ni, 86.0% id, 0.0% wa, 0.0% hi, 0.0% si, 0.0% st
Mem: 66082088k total, 29512860k used, 36569228k free, 756352k buffers
Swap: 32767992k total, 1019900k used, 31748092k free, 15710284k cached

  PID USER PR NI VIRT RES SHR S% CPU% MEM TIME + COMMAND 27855 rdtfare 20 0 4454m 1.3g 5300 S 0.7 2.0 338: 31.37 java
 2034 jenkins 20 0 18.3g 5.2g 5284 S 0.3 8.2 56: 02.38 java 12156 rdtfare 20 0 4196m 1.2g 12m S 0.3 2.0 86: 34.62 java
8.3. More powerful tool

htop

htop is an interactive process under Linux a browser can be used to replace the top command under Linux.

Compared with the traditional Linux top, htop more humane. It allows the user interactive operation, support for color themes can be horizontal or vertical scroll through the list of processes, and mouse support.

Compared with the top, htop has the following advantages:

It can be horizontal or vertical scroll through the list of processes, in order to see all of the processes and the complete command line.
At the launch, faster than the top.
No need to enter the process when the scrapping process.
htop mouse support.
     
         
         
         
  More:      
 
- Linux server Php injection prevention (Linux)
- Spring declarative transaction management (Programming)
- CentOS network configuration 7, and set the host name and IP-bound problems (Linux)
- You really do need to know a variety of programming languages (Programming)
- Java threads and thread pools (Programming)
- Linux scp remote file copy (Linux)
- Oracle RMAN-06023 and ORA-19693 errors (Database)
- Linux system security settings (Linux)
- How to build Memcached Docker container (Server)
- Varnish achieve page jump (Server)
- ORA-38856: Unable instance UNNAMED_INSTANCE_2 (redo thread 2) marked enabled (Database)
- MySQL + Corosync + Pacemaker + DRBD build highly available MySQL (Server)
- Linux security settings Basics (Linux)
- OpenGL ES 3.0 vertex buffer (Programming)
- How to Disable Linux IPv6 (Linux)
- Gentoo: existing preserved libs problem solving (Linux)
- Python-- for anomalies and reflection of objects articles (Programming)
- Single-node Hadoop installation notes distributed pseudo & (Server)
- Linux 6 install Oracle 11g (64bit) (Database)
- Install Visual Studio Code in Ubuntu (Linux)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.