Linux PS command to use the detailed

Source: Internet
Author: User
Tags current time memory usage sleep cpu usage
the Linux PS command lists the processes that are running at the current time. through the PS command we can know the status of the process, memory footprint, start time, and so on.
ps Command section options:
PS Command output column field Description:

Field Description
%cpu How many CPUs are being used by a process
%mem How much memory is being used by the process
ADDR Memory address of the process
C or CP CPU Usage and scheduling information
command* Process name, including parameters (if any)
NI Nice value
F Sign
Pid Process ID
PPID Parent Process ID
Pri Process priority
Rss Real Memory usage
S or STAT Process status Code process State is represented by characters, such as R (running is running or ready to run), S (sleeping Sleep), I (Idle idle), Z (Zombie), D (non-disruptive sleep, usually I/O), P (wait for swap page), W (swap out, Indicates that the current page is not in memory), N (Low priority Task) T (terminate terminated), W has no resident pages
START or Stime Process Start time
VSZ Virtual Memory usage
Time Total CPU Usage
tt or TTY Process-related terminals
UID or user User name of the process owner
Wchan The memory address of the event that the process waits for, the kernel function name that the process is sleeping on, and the name of the function is obtained from the/root/system.map file.

(1) List all running processes
Ps-ef
Ps-aux

(2) List processes based on user or process name or grep
Ps-u MySQL
Ps-c mysqld
Ps-aux | grep MySQL

(3) Sort the process by memory and CPU
PS aux--sort=-pcpu | Head-5 #按cpu占用从大到小排序
PS aux--sort=-pmem | Head-5 #按内存占用从大到小排序

(4) Display process information in a tree structure (via--forest option)
Ps-f--forest-c Chrome

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.