Task Manager-top Command under Linux/unix

Source: Internet
Author: User
Tags memory usage cpu usage

Task Manager under Windows is not easy to use (individuals prefer Process Explorer), but it is also convenient to view processes, CPU, memory ... It's also easy to end the process

There is no GUI Linux, there are commands to implement Windows Task Manager function, this command is "top", the user can use top to sort the process, end the process and so on.

The top command is a common performance analysis tool under Linux that shows the resource usage of each process in real time, and refreshes the list of processes by default for 5 seconds, so it is similar to the Task manager for Windows.

Statistical information about the current system as a whole

The top five elements of the first command display are statistical information about the system as a whole.

The first line is the task queue information, with the execution result of the uptime command. eg.

top-15:09:51 up + days, 3:38, 4 users, Load average:1.09, 3.39, 4.76

15:09:51 Current time
up + days, 3:38 system run time, format last:
4 users currently logged on
Load average:1.09, 3.39, 4.76 system payload, which is the average length of the task queue.
The three values were 1 minutes, 5 minutes, and 15 minutes ago to the present average.

The second to third behavior process and CPU information. When there are multiple CPUs, the content may be more than two lines. eg.

tasks:115 Total, 1 running, sleeping, 0stopped, 0zombie
Cpu (s): 16.1% us, 2.0% sy, 0.0% ni, 79.5% ID, 1.4% wa, 0.0% Hi, 1.0% si

tasks:115 Total Process Totals
1 Running number of running processes
sleeping number of sleep processes
0 stopped stop process number
0 Zombie Number of zombie processes
CPU (s): 16.1% US user space consumes Cpu percentage
2.0% Sy percentage of CPU consumed by kernel space
0.0% CPU Percentage of processes that have changed priority within NI user process space
79.5% ID idle CPU percent
1.4% wa Wait for the input output CPU time percentage
0.0% hi
0.0% si

The last two behavior memory information. eg.

mem:8169876 k Total, 7686472 K used, 483404 K free, 35272 K buffers
swap:4096532 k Total, K-used, 4096372 K free, 2477532 K Cached

mem:8169876 ktotal Total Physical Memory
7686472 K used total amount of physical memory used
483404 k free memory Total
35272 k buffers memory used as the kernel cache
swap:4096532 k Total Total Swap partition
Total swap area used by used K
4096372 k Free swap area total
2477532 K Cached buffers The total number of swap areas.

The in-memory content is swapped out to the swap area and then swapped in to memory, but the used swap area has not been overwritten, which is the size of the swap area where the content already exists in memory. When the corresponding memory is swapped out again, it is no longer necessary to write to the swap area.

Process information

The details of each process are shown below the statistics area. Let's start by understanding the meaning of the columns.

PID USER PR NI VIRT RES SHR S%cpu%MEM time+ COMMAND

Ordinal column name meaning
pid    process ID
ppid    parent process ID
ruser    realusername
uid    The user ID of the process owner
user    The user name of the process owner
group    The group name of the process owner
tty    the terminal name of the startup process. Processes that are not started from the terminal are displayed as?
pr    Priority
ninice     value. Negative values indicate high priority, positive values indicate low priority
p    last used CPU, only make sense in multi-CPU environments
%cpu    CPU time consuming percentage last updated to current
Total CPU time used by the time    process, in seconds
time+    The total CPU time used by the process, in 1/100 seconds
%mem   Percent of physical memory used by the   process
The total amount of virtual memory used by the virt    process, in kilobytes. The Virt=swap+res
swap    process uses the amount of virtual memory that is swapped out, in kilobytes. The size, in kilobytes, of the physical memory used by the
res    process and not swapped out. Res=code+data
code    The physical memory size that executable code occupies, in kilobytes
data    the amount of physical memory that is consumed by parts other than executable code (data segment + stack) , Unit KB
shr    shared memory size, KB
nflt    page error
ndrt    last written to now, The number of pages that have been modified.

S process state.
d= non-disruptive sleep state
R= Run
S= Sleep
t= Tracking/Stopping
z= Zombie Process

Command name/command line
Wchan If the process is sleeping, the system function name in sleep is displayed
Flags task flag, reference sched.h

Sort by specified column

Top can be set to sort by an item, by default it is sorted by CPU usage,

M, (note upper case), sorted by memory usage

P, sort based on percent CPU usage

T, sorted by Time/accumulated time.

How to end a process

Enter the letter k(lowercase), and then enter the PID you want to kill

Of course you can also run the command directly, kill the PID

Top Other uses

Other uses of top, can be in the top interface, Lose "H", you can go to the top command Help interface

Task Manager-top Command under Linux/unix

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.