PS, which represents the abbreviation for process status English, is mainly used to list detailed system processes. Like ordinary Linux server users more commonly used is the top command to list and view the current server snapshot process parameters. However, if we need to do the actual detection state of the server environment and detailed process command purposes, we need to use more PS commands.
In this article, the old left when you see the PS command, so they sorted out, although most also did not contact and fuzzy Some, may have contact later, so first sorted out so that you may need to refer to later.
First, not with any parameters
Here is not using any parameters, you can see that there are 4 sets of data, PID on behalf of the process ID, TTY on behalf of the process location, time for the execution process used, CMD represents the current command.
Second, show all the processes
The code is as follows |
Copy Code |
Ps-ax | Less |
Third, according to user filtering
This is where the filtering process is consumed based on the actual user.
Based on CPU, memory consumption filter
Filter by Process ID
This is filtered by the process keyword after-c.
Filter by the specified process ID
Seven, displaying processes in a hierarchy
Eighth, display security information
Ninth, display as root user format process
Tenth, real-time process view
The above 10 commonly used PS command collation, the general user includes myself to look also dizzy, must in the actual need to use the time or the specific environment time uses when again familiar contrast is better. Let's start with the record, and then look at the detailed application when you need it later.
Add:
Name: PS
Use Rights: All users
Use mode: PS [options] [--help]
Description: Shows the dynamic of the instantaneous stroke (process)
Parameter: PS parameters are very many, here only a few commonly used parameters and introduce the meaning of
-A lists all processes
-W display widens to show more information
-au displays more detailed information
-aux shows all travel with other users
############################################################
Common parameters:
-a displays all processes (equivalent to-e) (utility)
-a displays all processes for a terminal, except for session leads
-N ignores the selection.
-D displays all processes, but omits all session leads (utility)
-X shows the process without a control terminal and shows the specific path of each command. DX is not suitable. (utility)
The time that the-p PID process uses the CPU
-U uid or username Select a valid user ID or user name
G-GID or groupname displays all processes for the group.
U username displays all the processes under the user and displays the detailed paths for each command. such as: PS U Zhang; (utility)
-F is all listed and is typically associated with other options. such as: Ps-fa or Ps-fx and so on.
-L long format (with fields such as F,wchan,c)
-J Job Format
-o user-defined format.
V is displayed in virtual memory format
s in signal format display
-M shows all threads
-H displays the level of the process (shared with other commands, such as: ps-ha) (utility)
e command to display the environment after (for example: ps-d e; Ps-a e) (utility)
H does not display the first row
############################################################
ps Command common usage (easy to view system process)
1) PS A shows all programs under the current terminal, including other user programs.
2) ps-a displays all processes.
3) PS C lists the program, displaying the actual instruction name of each program, without the path, parameter, or indication of the resident service.
4) Ps-e The effect of this parameter is the same as the specified "A" parameter.
5) PS e Displays the environment variables used by each program when the program is listed.
6) PS F Displays the tree structure in ASCII characters, expressing the interrelationships between programs.
7) ps-h displays a tree structure that represents the interrelationships between programs.
8) ps-n displays all programs except those under the PS instruction terminal.
9) PS s uses the program signal format to display the program status.
Ten) PS S lists programs, including interrupted subroutine data.
One) ps-t< Terminal number > Specifies the terminal number, and lists the status of the program belonging to the terminal.
a) PS u displays program status in a user-oriented format. The
-PS x shows all programs and is not differentiated by terminals.