Linux Process Learning

Source: Internet
Author: User
Tags cpu usage

-------------------------------------------------------------------------------------------

PS shows the status of the instantaneous process, not dynamic continuous, if you want to control the process time, you should use the top


-A lists all trips
-W display widen to show more information
-au Show more detailed information
-aux Show all processes that contain other users # usually use more PS Axu #

-E Show All processes

-F Displays all information for all processes

-r displays only running processes

-X displays process information on all non-control terminals

xian-squ-1:~ # PS aux

USER PID%cpu%MEM VSZ RSS TTY STAT START T IME COMMAND

User process number CPU consumption memory consumption virtual memory consumption (KB) physical memory terminal State process start time Process execution time corresponding command

650) this.width=650; "title=" clipboard "style=" Border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt = "Clipboard" src= "Http://img1.51cto.com/attachment/201408/11/8976580_1407772253bDM1.png" height= "/>"

Usually we can also add a filter command to check a particular program process.

--------------------------------------------------------------------------------------------------------------- ----------------------------------

The TOP command can be used to dynamically monitor the server's process information. In the process of dynamic monitoring, the user can refresh the state by pressing the key

ch-hov-ftp1:/# Top

Top-13:56:27 up, 2:42, 2 users, load average:0.02, 0.04, 0.00 #系统运行时间 and load real-time output #

tasks:100 Total, 1 running, sleeping, 0 stopped, 0 zombie #系统任务 #


Meaning: Total number of processes running process count number of processes that have been stopped process number of zombie processes


Cpu (s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st #CPU的占用情况 #

Meaning: US----user space occupied CPU percentage;    
                     sy----CPU percentage in kernel space;      
                     NI----CPU percentage     &NBSP for processes that have changed priority within the user process space;
                     ID----Idle CPU percent      
                     wa--percentage of CPU time waiting for input and output      
                     hi----??      
                     si-----??

mem:3916396k Total, 3879364k used, 37032k free, 129500k buffers #内存的占用情况 #

Meaning: Total----amount of physical memory
Used----Total amount of physical memory used
Free-----Total Idle memory
buffers--memory used as the kernel cache

swap:8393952k Total, 116k used, 8393836k free, 3505092k cached #交换空间的使用情况 #

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

Process number process user process priority Level process priority numeric virtual memory physical memory shared memory CPU memory enable time Start command

In the use of the top command, you can use the following interactive commands to accomplish some of the viewing interactions

650) this.width=650; "title=" clipboard[1] "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt = "Clipboard[1]" src= "http://img1.51cto.com/attachment/201408/11/8976580_1407772254HBlu.png" height= "/>"

    • Input 1-View the usage of each logical CPU

650) this.width=650; "title=" clipboard[2] "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt = "Clipboard[2]" src= "http://img1.51cto.com/attachment/201408/11/8976580_1407772255W6Os.png" height= "/>"

    • Enter F-View the options that can be displayed, * indicates what has been shown, for example we want to show dirty pages, can enter V, then spaces refresh

650) this.width=650; "title=" clipboard[3] "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt = "Clipboard[3]" src= "Http://img1.51cto.com/attachment/201408/11/8976580_1407772257UcBY.png" height= "169"/>


650) this.width=650; "title=" clipboard[4] "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px;padding-right:0px; "border=" 0 "alt = "Clipboard[4]" src= "http://img1.51cto.com/attachment/201408/11/8976580_1407772258dlDi.png" height= "/>"

    • Input p: sort/input m according to CPU usage input T sort by memory size by cumulative time

    • Use R to adjust priority, use K to kill process 650) this.width=650; "title=" clipboard[5] "style=" border-top:0px;border-right:0px; background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px; padding-right:0px; "border=" 0 "alt=" clipboard[5] "src=" http://img1.51cto.com/attachment/201408/11/8976580_ 1407772258olc1.png "height=" "/>650" this.width=650; "title=" clipboard[6] "style=" border-top:0px;border-right : 0px;background-image:none;border-bottom:0px;padding-top:0px;padding-left:0px;margin:0px;border-left:0px; padding-right:0px; "border=" 0 "alt=" clipboard[6] "src=" http://img1.51cto.com/attachment/201408/11/8976580_ 1407772259wumr.png "height=" Panax/>

Kill top process to exit top, of course, we usually use Q to exit

650) this.width=650; "title=" clipboard[7] "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px, "border=" 0 "alt=" clipboard [7] "src=" http://img1.51cto.com/attachment/201408/11/8976580_1407772259Yzwc.png "height="/>

--------------------------------------------------------------------------------------------------------------- ----------------------------------

xian-squ-1:~ # pgrep Squid #pgrep可以用来查看相关程序所有的进程号 #

10746

26318

-------------------------------------------------------------------------------------------

Kill is used to abort the process, the default 15 shutdown program, using 9 is the Force shutdown program, used to kill the zombie process
Killall can kill all related processes directly by using the name of the program.


ch-hov-ftp1:/# lsof-i:20 #除了ps命令之外, you can use the list open files to view #

COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME

VSFTPD 8868 UHC 7u IPv4 54770204 TCP ch-hov-ftp1.hovschina.com:ftp-data->10.2.10.144:57834 (established)

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.