PS of Linux Process Control commands

Source: Internet
Author: User

  • No parameters
    By default, only the processes that are executed under the current terminal are displayed, not the information for the other terminals, and the information displayed is only 4 columns, as follows:

    [email protected]:~$ ps
    PID TTY TIME CMD
    17742 pts/14 00:00:00 bash
    30496 pts/14 00:00:00 ps

    The meanings of the four column information are:
    PID: The process number of the command (CMD) running
    TTY: Where the command is running (terminal)
    Time: CPU processing times consumed by the command that is running
    CMD: The command that the process runs

  • Parameters-L and-F
    To get more information, you need to add one of these two parameters, as follows:

    [email protected]:~$ 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 the extra columns are:
    F: The flag of the process, also known as the semaphore, for the process of mutual exclusion locking, etc., temporarily do not consider;
    S: Status of the process (s) for hibernation, R for Run, Z for zombie process, T for stop, 0 for running)
    UID: User id,ppid: Parent process ID
    C:CPU Utilization
    PRI: Priority of the process
    Ni:nice value, also known as the degree of humility ...
    ADDR: Memory address of the process
    SZ: The join process is swapped out, the size of the required swap space
    WCHAR: Whether the process is running, or "-", similar to the function of S
    Duration: Total CPU time required to run the process
    Well, many of these messages are not used or understood, do not worry, slowly, sooner or later will use.


    [email protected]:~$ ps -f
    UID PID PPID C STIME TTY TIME CMD
    m 17742 14494 0 5月28 pts/14 00:00:00 bash
    m 32105 17742 0 11:55 pts/14 00:00:00 ps -f

    -F Displays less information and is partially different.
    The main thing is stime, which means the time the process was triggered or when it started.

  • Parameters-A and-e, which are the same, are used to show all processes, not just processes under the current terminal, but also processes that are not running at the terminal.
  • Parameter-A, this parameter is very magical, anyway I do not understand, man on the message is: Select all processes except both session leaders (see GETSID (2)) and processes not Associat Ed with a terminal. Probably means that it shows all processes except the control process (session leader) and the non-terminal process. Look at an example:


    [email protected]:~$ ps -a
    PID TTY TIME CMD
    24056 pts/18 00:00:00 ps

    We know that some processes do not need to be run with terminals, and their TTY column shows "? "The-a option filters out such processes, while-a also filters out the control process, what exactly is the control process?" Is the terminal itself? If the-a parameter is not added, the result is as follows:

    [email protected]:~$ ps
    PID TTY TIME CMD
    23962 pts/18 00:00:00 bash
    24062 pts/18 00:00:00 ps

    This understanding may be right.

  • Parameter-D: similar to-a, except that it does not filter the no-terminal process, but only the filtering control process-the terminal.
  • Parameter-u: Shows the process of a valid user ID in the userlist list. It's not really good to understand, he needs to be followed by a user name, indicating that only the processes associated with that user are displayed. However, if you do not follow the user name, the effect is the same as "PS U" is the same (note that there is no short horizontal line), which is also the PS command complex place, for some parameters have no short horizontal line difference is very large.
    The PS u represents the display user-oriented format as follows:

    [email protected]:~$ 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 this time the meaning of-a is not the same as when used alone. In short,-au = =-a-u = = Au,a In these combinations means all. (Well, it's complicated to say. )
  • The parameter-p, followed by the process ID, displays information for a particular process, equivalent to p without a dash. There are also processes that can place their IDs directly behind a dash, such as:

    [email protected]:~$ ps -1
    PID TTY STAT TIME COMMAND
    1 ? Ss 0:02 /sbin/init
  • Parameter-C: followed by the full name of a command or program to display relevant information.
  • Parameter x: Typically used with AU, you can list more complete information. I intercepted part of it:

    USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMANDroot         1  0.0  0.0   4584  2580 ?        Ss    5月28   0:02 /sbin/initroot         2  0.0  0.0      0     0 ?        S     5月28   0:00 [kthreadd]root         3  0.2  0.0      0     0 ?        S     5月28  10:10 [ksoftirqd/0]root         4  0.0  0.0      0     0 ?        S     5月28   0:00 [kworker/0:0]

    It seems to be more detailed than-F and-L.

    Well, it's been dizzy here, there are too many parameters, I think I'll do it again according to the actual demand. The main fact is the following two combinations:
    Ps-ef
    PS aux
    Then, with grep, you use the pipeline to retrieve the related process information.

PS of Linux Process Control commands

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.