Linux view process PS command details

Source: Internet
Author: User

Ps command is a very powerful process view command in the most fundamental circumstances. this command can be used to determine which processes are in the running and running status, whether the process is terminated, whether the process is dead, and which processes occupy excessive resources. in short, most of the information can be obtained by executing this command.


View process ps commands and parameters in Linux


In Linux, the ps command is most often used to monitor the working conditions of background processes, because background processes do not use the standard input/output settings such as the screen keyboard.
To detect the situation, you can use the ps command.
The syntax of this command is as follows:
Ps [Option]
-E: displays all processes and environment variables.
-F full format
-H: No title is displayed.
-L long format
-W width output
A: displays all processes on the terminal, including those of other users.
R only displays Running Processes
X indicates that no terminal process is controlled.
O [+ |-] k1 [, [+ |-] k2 [,…] The process list is displayed in the multilevel sorting order specified by the shortcut keys in keys, k1, and k2.
The default sequence is specified for different ps formats. these default sequence can be overwritten by user-specified. here, the "+" character is optional, and the "-" character is used to reverse the specified key direction.
Pids lists only process identifiers separated by commas (,). The process list must be followed by the last option of the command line parameter, and spaces cannot be inserted in the middle. For example: ps-f1, 4, 5.
The following describes long command line options. These options start:
-- SortX [+ |-] key [, [+ |-] key [,…] Select a multiple keys from the SORTKEYS segment. the "+" character is optional, because the default direction is in ascending order of numbers or dictionary order. for example, ps-jax-sort = uid,-ppid, + pid.
-- Help: displays help information.
-- Version: displays the local version of the command.
The sort key is mentioned in the preceding option description. Next, we will further describe the sort key. note that the land use value in the sorting operation is the internal value of the ps application, not only the pseudo value in some output formats. the sorting Key List is shown in Table 4-3.
Table 4-3 sorting Key List c
Cmd
Executable simple name C
Cmdline
Complete command line f
Flags
Long MODE flag
Pgrp
Process location Group IDG
Tpgid
Control tty Process Group ID
Jcutime
Cumulative user time J
Cstime
Accumulative system time k
Utime
User time K
Stime
System Time m
Min_flt
Number of secondary page error locations M
Maj_flt
Key page error count n
Cmin_flt
Accumulative secondary page error N
Cmaj_flt
Accumulative Key page Error
O
Session
Dialog ID
P
Pid
Process ID
P
Ppid
Parent process ID
R
Rss
Resident size
R
Resident
Resident Page s
Size
Memory size (kilobytes)
S
Share
Number of shared page locations t
Tty
Tty secondary device No. T
Start_time
Process start time U
Uid
UID
User
User Name
V
Vsize
Total number of local virtual memory (bytes)
Y
Priority
Kernel scheduling priority


3. Linux processes often use ps Command Parameters


The three most frequently used parameters are u, a, and x. The following uses examples to describe their usage.
[Example 20] log on to the system as root to view the current process status
$ Ps
PIDTTYTIMECOMMAND
5800ttyp000: 00: 00 bash
5835ttyp000: 00: 00 ps
As you can see, projects are divided into four items: PID (process ID), TTY (terminal name), and TIME (process execution TIME)
COMMAND (COMMAND line input of the process ).
You can use the u option to view the process owner and other details, as shown below:
$ Psu
USERPID % CPU % MEMUSZRSSTTYSTATSTARTTIMECOMMAND
Test58000.00.418921040ttyp0SNov270: 00-bash
Test58360.00.32528856ttyp0RNov270: 00psu
There is a horizontal line in front of the bash process, which means that the process is logged on to the shell by the user, so for a login user, there is only one process with a transient line. the options % CPU and % MEM are also displayed. The former indicates the percentage of CPU time and total time occupied by the process, and the latter indicates the percentage of memory occupied by the process and total memory.
In this case, we can see all the processes that control terminals. Of course, we still haven't observed other processes that do not control terminals. Therefore, we need to use the x option. you can use the x option to view all processes in the process.

This article from the CSDN blog, reproduced please indicate the source: http://blog.csdn.net/jbgtwang/archive/2009/01/08/3734881.aspx

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.