Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Top command: the Task Manager under linux     - Postgres-X2 deployment steps (Database)

- RedHat Linux 9.0 under P4VP-MX motherboard graphics resolution of problems (Linux)

- CentOS NAT iptables (Linux)

- Linux fixes fatal error: x264.h: No such file or directo (Linux)

- CentOS yum source configuration (Linux)

- Linux nice program origin of the name (Linux)

- Use XtraBackup be physical standby database MySQL (Database)

- Linux system - The understanding cpu load (Linux)

- Linux System Getting Started Learning: After starting in Ubuntu or Debian, enter the command line (Linux)

- Some common regular expressions (Linux)

- Linux garbled file delete method (Linux)

- GEC2440 easiest a kernel compile Linux2.6.30.4 (Programming)

- Using iptables achieve NAT (Linux)

- Linux user login and IP restrictions (Linux)

- How comprehensive resist attacks from the network (Linux)

- Ubuntu apt-mirror established local private sources (Linux)

- Ceph Source Analysis: Network Module (Server)

- Ubuntu deployment Flask + UWSGI + Nginx Comments (Server)

- Linux kernel to achieve soft RPS network to receive soft interrupt load balancing to distribute (Linux)

- Oracle Database Performance Optimization of memory disk (Database)

 
         
  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 alarms using Java (Server)
- Precautions against hackers Linux environment (Linux)
- Linux Shell Scripting (Programming)
- A drop datafile Oracle bug (Database)
- Kubernetes resolve application deployment model (Server)
- CentOS 7 How to install MySQL Server (Database)
- Linux System Getting Started Tutorial: How do you know Shell which is currently being used (Linux)
- Linux System Getting Started Tutorial: How to automatically set the JAVA_HOME environment variable on Linux (Linux)
- Linux kernel compilation, the configuration of the motor drive (Programming)
- Use FirewallD build dynamic firewall (Linux)
- Ubuntu 14.04 installed NVIDIA graphics driver (Linux)
- Handle large data problems Bit-map method (Programming)
- Linux Shell Understanding and Learning (Linux)
- How to install Perl modules from CPAN (Linux)
- 25 Git Usage Tips (Linux)
- Swift acquaintance of values and references, the circular reference, Agent Precautions (Programming)
- Sqoop data export import command (Database)
- Several SQL Server data migration / Export Import Practice (Database)
- Source install Python3.4 on CentOS (Linux)
- To install Git on Ubuntu systems (Server)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.