-
No Parameter
By default, only processes executed on the current terminal are displayed. Information on other terminals is not displayed, and only four columns are displayed, as shown below:
m@meng:~$ ps
PID TTY TIME CMD
17742 pts/14 00:00:00 bash
30496 pts/14 00:00:00 ps
The meanings of the four columns are as follows:
PID: The process Number of the running command (CMD)
TTY: Location of the command (Terminal)
TIME: the CPU processing TIME occupied by the running command
CMD: The Command run by the process.
-
Parameters-l and-f
To get more information, you need to add one of the two parameters, as shown below:
m@meng:~$ ps -l
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
0 S 1000 17742 14494 0 80 0 - 2433 wait pts/14 00:00:00 bash
0 R 1000 30507 17742 0 80 0 - 1665 - pts/14 00:00:00 ps
The meanings of multiple columns are as follows:
F: the flag of a process, also known as a semaphore, used for mutual exclusion and lock of processes;
S: Process status (S indicates sleep, R indicates running, Z indicates botnets, T indicates stopping, and 0 indicates running)
UID: User id, PPID: parent process id
C: CPU usage
PRI: Process Priority
NI: nice value, also called humility...
ADDR: Memory Address of the process
SZ: The size of swap space required for the process to be swapped out
WCHAR: whether the process is running. If yes, it is "-", which is similar to S.
TIME: total cpu time required to run the process
Well, a lot of this information cannot be used or understood for the time being. Don't worry, come on, and use it later or later.
M @ meng :~ $ Ps-f
UID PID PPID C STIME TTY TIME CMD
M 17742 14494 0 May 28 pts/14 00:00:00 bash
M 32105 17742 0 00:00:00 pts/14 ps-f
-F displays less information, and is partially different.
It mainly refers to STIME, which means the time when the process is triggered or the time when it is started.
- Parameters-A and-e have the same functions and are used to display all processes. They are not only processes on the current terminal, but also processes that are not running on the terminal.
-
Parameter-a: this parameter is amazing. I didn't understand it anyway. The information on man is: Select all processes failed t both session leaders (see getsid (2 )) and processes not associated with a terminal. it indicates all processes except the control process (session leader) and the non-end process. Let's look at an example:
m@meng:~$ ps -a
PID TTY TIME CMD
24056 pts/18 00:00:00 ps
We know that some processes do not need to run through terminals. Their TTY column is displayed as "?", -Option a filters out such processes, and-a also filters out the control processes. What is the control process? Is it the terminal itself? If the-a parameter is not added, the result is as follows:
m@meng:~$ ps
PID TTY TIME CMD
23962 pts/18 00:00:00 bash
24062 pts/18 00:00:00 ps
This may be correct.
- The-d parameter is similar to-a, except that it does not filter non-terminal processes, but only filters control processes-terminals.
- Parameter-u: displays the processes of valid user IDs in the userlist. This is actually not easy to understand. He needs to follow a user name to show only the user-related processes. However, if-u is not followed by the user name, the effect will be the same as "ps u" (note that the u here does not have a short horizontal line), which is also a complicated place for ps commands, there is a big difference between some parameters.
The ps utable shows the Display user-oriented format as follows:
m@meng:~$ ps u
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
m 24187 0.0 0.1 9732 4324 pts/14 Ss 16:40 0:00 bash
m 24245 0.0 0.0 6896 1152 pts/14 R+ 16:50 0:00 ps u
-U is often used with-a, but the meaning of-a is different from that used separately. In short,-au =-a-u = au, a in these combinations means all. (Complicated to say ..)
- Parameter-p, followed by the process id, displays information about a specific process, which is equivalent to p without a hyphen. Some other processes can directly put their IDs behind the dash, such:
m@meng:~$ ps -1
PID TTY STAT TIME COMMAND
1 ? Ss 0:02 /sbin/init
- Parameter-C: The full name of a command or program.
-
Parameter x: usually used with au to list complete information. I intercepted some of them:
User pid % CPU % mem vsz rss tty stat start time COMMANDroot 1 0.0 0.0 4584 2580? Ss May 28 0:02/sbin/initroot 2 0.0 0.0 0 0? S May 28 0:00 [kthreadd] root 3 0.2 0.0 0 0? S May 28 10:10 [ksoftirqd/0] root 4 0.0 0.0 0 0? S May 28 0:00 [kworker/]
It seems to be more detailed than-f and-l.
Er, I am dizzy when writing this article. There are too many parameters. I think I will try again later based on my actual needs. The main difference is the following two combinations:
Ps-ef
Ps aux
Then, use the grep pipeline to retrieve related process information.