Ps command details, process status

Source: Internet
Author: User
Ps command details, process status name: ps usage permission: all users usage: ps [options] [-- help] description: displays the dynamic parameters of the process: there are many ps parameters. here, only A few common parameters are listed and their meanings are briefly described.-A lists all the parameters... ps command details, process status name: ps usage permission: all users usage: ps [options] [-- help] description: displays the dynamic parameters of the process: ps has many parameters, only A few common parameters are listed here and their meanings are briefly described.-A lists all the Itineraries.-w: show widening. More information is displayed.-au: show more details.-aux: show all other parameters. user's itinerary au (x) output Format: user pid % CPU % mem vsz rss tty stat start time commanduser: Travel owner PID: pid % CPU: occupied CPU usage % MEM: occupied memory usage V SZ: occupied virtual memory size RSS: occupied memory size TTY: terminal secondary device number (minor device number of tty) STAT: Status of the trip: D: non-disruptive static R: in progress S: static state T: paused run Z: nonexistent but temporarily unavailable W: Not enough memory paging allocable <: high-priority stroke N: low-priority stroke L: Memory paging allocation and lock in the memory START: Stroke start time: execution time command: example of the executed command: psPID tty time limit 2791 ttyp0 00:00:00 tcsh3092 ttyp0 00:00:00 ps % ps-apid tty time CMD1? 00:00:03 init2? 00:00:00 kflushd3? 00:00:00 kpiod4? 00:00:00 kswapd5? 00:00:00 mdrecoveryd... % ps-auxUSER PID % CPU % mem vsz rss tty stat start time COMMANDroot 1 0.0 0.7 1096 472? S Sep10 init [3] root 2 0.0 0.0 0 0? SW Sep10 [kflushd] root 3 0.0 0.0 0 0? SW Sep10 [kpiod] root 4 0.0 0.0 0 0? SW Sep10 [kswapd] ...... ps aux ---------------------------------------------------------------------- user pid % CPU % mem vsz rss tty stat start time COMMANDroot 1 0.0 0.0 1340 440? S Nov05 initroot 2 0.0 0.0 0 0? SW Nov05 [keventd] root 3 0.0 0.0 0 0? SW Nov05 0: 00 [keventd]... -------------------------------------------------- the USER field specifies the USER who started the command. the USER can view the CPU occupied by a process, memory usage, VSZ (virtual memory size), and RSS (resident set size ): VSZ indicates the amount of memory space required for a program to fully reside in the memory; RSS indicates the actual amount of memory occupied; STAT displays the current state of the process: "S ": the process is in sleep state, indicating that these processes are waiting for certain events-may be user input or availability of system resources; after a process calls exit, the process does not disappear immediately, instead, it leaves a data structure called Zombie. Among the five states of a Linux process, a zombie process is a very special one. it has abandoned almost all the memory space, no executable code, and cannot be scheduled, only one location is retained in the process list, and information such as the exit status of the process is recorded for collection by other processes. In addition, zombie processes no longer occupy any memory space. The function of calling exit is to exit a process, but it is only limited to converting a normal process into a zombie process and cannot be completely destroyed. Once a process calls wait, it immediately blocks itself. wait automatically analyzes whether a sub-process of the current process has exited. if it finds such a sub-process that has become a zombie, wait will collect information about this sub-process and destroy it completely and return it. if such a sub-process is not found, wait will be blocked until one appears. Run ps aux to the following information: ps auxUSER PID % CPU % mem vsz rss tty stat start time COMMANDsmmsp 3521 0.0 0.7 6556 1616? Ss 01:00:00 sendmail: Queue runner @ froot 3532 0.0 0.2 2428? Ss gpm-m/dev/input/mice-t imps2htt 3563 0.0 0.0 2956 196? Ss/usr/sbin/htt-retryonerror 0htt 3564 0.0 1.7 29460 3704? Sl htt_server-nodaemonroot 3574 0.0 0.4 5236? Ss crondxfs 3617 0.0 1.3 13572 2804? Ss xfs-droppriv-daemonroot 3627 0.0 0.2 3448 552? SNs anacron-sroot 3636 0.0 0.1 2304 420? Ss/usr/sbin/atddbus 3655 0.0 0.5 13840? Ssl dbus-daemon-1 -- system .................................. .. the parameter meaning in stat is as follows: D cannot be interrupted. Uninterruptible (usually IO) R is running, or process S in the queue is in sleep state T stop or be tracked Z botnet W enters the memory swap (it is invalid from kernel 2.6) X dead process Specify the terminal number and list the status of the program that belongs to the terminal. 12) ps u displays the program status in user-based format. 13) ps x shows all programs, which are not distinguished by terminals. The most common method is ps-aux. then, a pipeline symbol is used to direct to grep to find a specific process and then operate on the specific process. There are 5 Processes in linux: 1. running (running or waiting in the running queue) 2. interruption (sleep, blocked, waiting for the formation of a condition or receiving a signal) 3. do not interrupt (do not wake up when receiving the signal or do not run, the process must wait until an interruption occurs) 4. dead (the process has been terminated, but the process descriptor exists until the parent process calls wait4 () released after the system call) 5. stop (the process stops running after receiving SIGSTOP, SIGSTP, SIGTIN, and SIGTOU signals) five status codes of the process identified by the PS tool: D uninterruptible sleep (usually IO) R run runnable (on run queue) S interrupt sleepingT stop traced or stoppedZ dead a defunct ("zombie") process Note: Other states also include W (no resident page ), <(high-priority process), N (low-priority process), L (memory lock page). Use the ps format output to view the process status: ps-eo user, stat .., cmd user username uid user No. pid process no. ppid parent process no. size memory size, Kbytes bytes. vsize total virtual memory size, bytes (including code + data + stack) share total number of shared pages nice process priority (default: 0, maximum:-20) priority (pri) percentage of physical memory shared by kernel scheduling priority pmem process trs program execution code resident size Total Physical memory used by rss process, kbytes byte time process execution: displays the uid, pid, stat, pri, and, sort by uid. ps-eo pid, stat, pri, uid-sort uid view the user, pid, stat, rss, arg of the current system process S, sorted by rss. ps-eo user, pid, stat, rss, args-sort rss, to monitor and control processes, you must first understand the current process, that is, you need to view the current process, ps commands are the most basic and powerful process view commands. You can use this command to determine which processes are running and running, whether the process is terminated, whether the process is dead, and which processes are occupying excessive resources. In short, most of the information can be obtained by executing this command. Ps provides a one-time view of the process. The results are not dynamically consecutive. to monitor the process time, use the top tool. Kill is used to kill a process. 1. ps parameter description ps provides many option parameters, which are commonly used in the following scenarios: l long format output; u displays processes by user name and startup time; j. display processes in the task format; f. display processes in the tree format; a. display all processes of all users (including other users); x. display processes of uncontrolled terminals; r displays running processes; ww avoids detailed parameter truncation; common options are combination of aux or lax and application of parameter f. 2. description of ps aux or lax output: owner of the USER process; ID of the PID process; parent PPID process; % CPU usage of the CPU process; % MEM memory usage; NICE value of the NI process. The value is large, indicating less CPU usage; virtual size of the VSZ process; number of pages in which RSS resides; TTY terminal IDSTAT process status (the following types are available) d. a sleep state that cannot be interrupted (usually an IO process); R is running and can be crossed in the queue; S is in sleep state; T is stopped or tracked; W enters the memory switch (which is invalid since kernel 2.6); X dead processes (never seen); Z botnets; <process with a higher priority N process with a lower priority L Some pages are locked into the memory; s process Leader (under which there are sub-processes); l multi-process (using CLONE_THREAD, similar to NPTL pthreads); + process Group in the background; process resources that WCHAN is waiting for; START process TIME; TIME process consumption CPU time; COMMAND name and parameters; 3. Application example [root @ localhost ~] # Ps-aux | more can be used | the MPs queue is connected to more for pagination. [Root @ localhost ~] # Ps-aux> ps001.txt [root @ localhost ~] # More ps001.txtthis shows all the processes and outputs them to the ps001.txt file. then, you can view them by page through more. 4. there are more than a dozen methods to control the kill process. Below are some common methods: kill-STOP [pid] sends SIGSTOP (17,19, 23) to STOP a process, instead of killing the process. Kill-CONT [pid] sends SIGCONT (, 25) to restart a stopped process. Kill-KILL [pid] sends SIGKILL (9) to force the process to stop immediately without cleaning. Kill-9-1 to terminate all processes you own. The SIGKILL and SIGSTOP signals cannot be captured, blocked, or ignored. However, other signals are acceptable. So this is your weapon.
Related Article

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.