Brief Introduction
The PS command in Linux is the abbreviation for process status. The PS command is used to list those processes that are currently running on the system. The PS command lists the current snapshots of those processes, which are the processes that are executing the PS command at the moment, dynamically displaying process information, and using the top command.
This command determines which processes are running and running, whether the process is complete, if the process is dead, which processes are consuming excessive resources, and so on. PS provides a one-time view of the process and provides a view of the results that are not dynamically contiguous. If you want to monitor process time, you should use the top tool. The Kill command is used to kill the process.
There are 5 states of processes on Linux:
- Running (running or waiting in the running queue)
- Interrupt (dormant, blocked, waiting for a condition to form or receive a signal)
- Non-interruptible (Received signal does not wake up and cannot be run, process must wait until interrupt occurs)
- Zombie (The process has been terminated, but the process descriptor exists until the parent process calls WAIT4 () after the system call is released)
- Stop (process received Sigstop, SIGSTP, Sigtin, Sigtou signal after stop running)
1. Command Format
ps[parameters]
2. Command function
Used to display the status of the current process
3. Command Parameters
A Show All Processes
-a displays all programs under the same terminal
-A Show All processes
C Displays the real name of the process
-N Reverse Selection
-e equals "-A"
e Display Environment variables
F show the relationship between programs
-H Display tree structure
R shows the process of the current terminal
T displays all programs for the current terminal
U specify all processes for the user
-au Show more detailed information
-aux Show all itineraries that contain other users
-C < commands > lists the status of the specified command
--lines < rows > number of rows displayed per page
--width < characters > The number of characters displayed per page
--HELP Display Help information
--version Display version display
4. Usage examples
Show All process information
Ps-a
Display information for a specified user
Ps-u Root
Show all process information, along with command line
Ps-ef
PS and grep common use combination to find specific processes
Ps-ef | grep ssh
List the PID and related information that is currently your own log in.
Ps-l
Linux under PS command