The use of PS command in Linux

Source: Internet
Author: User

To understand the current process when using Linux, you need to look at the current process, and the PS command is the most basic and very powerful process view command. Use this command to determine which processes are running and running, whether the process is complete, if the process is zombie, which processes are consuming too many resources, and so on. In short, most of the information can be obtained by executing the command.

PS gives us a one-time view of the process, it provides a view of the results is not dynamic continuous, if you want to monitor the process, you should use the top tool. Kill is used to kill the process.

1, PS parameter description

PS offers a number of options parameters, commonly used in the following several:

l long format output;

U displays the process in the order of the user name and start time;

J Use the task format to display the process;

F to display the process in a tree-shaped format;

A shows all processes of all users (including other users);

X shows the process without control terminal;

R shows the running process;

WW avoids detailed parameters being truncated;

Our common options are the combination of aux or lax, and the application of parameter F.

2. Explanation of PS aux or lax output

Owner of the USER process;

The ID of the PID process;

PPID parent process;

Percentage of CPU consumed by the%CPU process;

%MEM% of memory occupied;

The nice value of the NI process, which is large, means that it consumes less CPU time;

VSZ process virtual size;

The number of pages that RSS resides in;

TTY Terminal ID

STAT process status (with the following types)

D a dormant state (usually IO process) that cannot be interrupted;

R is running can be in the queue can be too line;

S is in a dormant state;

T stop or be traced;

W enters memory swap (invalid starting from kernel 2.6);

X dead process (never seen);

Z Zombie process;

< high-priority processes

N Low-priority processes

L Some pages are locked into memory;

Leader of the S-process (under it there are sub-processes);

L multi-process (using Clone_thread, similar to NPTL pthreads);

+ Process Group located in the background;

Wchan the process resources being awaited;

Start START process time;

The time the process consumes the CPU;

The name and parameters of the command commands;

3. Application examples

[Email protected] ~]# Ps-aux |more

Can be used | The pipe and more are linked up for pagination viewing.

[Email protected] ~]# Ps-aux > Ps001.txt

[Email protected] ~]# more Ps001.txt

Here is the display of all the processes, and output to the Ps001.txt file, and then through more to Page view.

4. Kill termination Process

There are more than 10 ways to control the process, here are some common methods:

Kill-stop [PID]

Send Sigstop (17,19,23) to stop a process without destroying it.

Kill-cont [PID]

Send Sigcont (19,18,25) to restart a stopped process.

Kill-kill [PID]

Send Sigkill (9) forces the process to stop immediately and does not implement a cleanup operation.

Kill-9-1

Stop all the processes you have.

SIGKILL and SIGSTOP signals cannot be captured, blocked, or ignored, but other signals can. So this is your ultimate weapon.

The above is a small part of the Linux PS command some simple summary, if you want to learn more about Linux tutorial knowledge can visit E Mentor Network.

The use of PS command in Linux

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.