tutorial on the use of PS commands and GITPS commands in Linux systems

Source: Internet
Author: User
Tags sort cpu usage

Ps

PS [-aacdefhjlmnvwy][acefghlnrsstuvxx][-c < directive name >][-g < Group name]

[G < group identification Code] [-p < process identification Code] [P < process identification Code] [-s < phase assignment]

[-T < terminal number] [T < terminal number] [-u < user ID] [-u < user ID]

[U < user name] [-< process identification code;] [--cols < number of characters per column]

[--columns < number of characters per column] [--cumulative] [--deselect] [--forest]

[--headers] [--help] [--INFO] [--lines < display number of columns] [--no-headers]

[--group < group name] [-group < Group identification Code] [--pid < process identification Code]

[--rows < display number of columns] [--sid < Phase assignment] [--tty < terminal number]

[--user < user name] [--user < user identification Code] [--version]

[--width < number of characters per column]

Parameter description:

-a displays the processes performed under all terminals, except for the stage operations leader.

A shows all processes under the current terminal, including the processes of other users.

-a displays all processes.

-C Displays the CLS and PRI fields.

c when the process is listed, the actual instruction name for each process is displayed, without the path, parameter, or indication of the resident service.

The-c< directive name > Specifies the name of the execution instruction and lists the status of the process for that directive.

-D displays all processes, but does not include processes for the stage job leader.

-e This parameter has the same effect as the specified "A" parameter.

e Displays the environment variables used by each process when the process is listed.

-F Displays Uid,ppip,c and Stime fields.

F Displays a tree structure with ASCII characters to express the interrelationships between processes.

-g< Group name > The effect of this parameter is the same as the specified "-G" parameter, which can also be specified using the name of the stage job leader.

G shows all processes under current terminals, including group leader processes.

-g< Group Identification Code > lists the status of processes belonging to the group, or it can be specified by using the group name.

H does not display a header column.

-h displays a tree structure that represents the interrelationships between processes.

-j or J Displays the status of the process in a work-controlled format.

-L or L displays the status of the process in a detailed format.

L list the relevant information about the place of the slaughter.

-M or m displays all threads.

N numbers to represent the user and Wchan fields.

-n Displays all processes except the processes under the PS instruction terminal.

-p< Process Identification Code > Specifies the process identifier and lists the status of the process.

p< Process identifier > The effect of this parameter is the same as the specified "-P" argument, and only slightly different in the list format.

R only lists the processes currently being performed by the current terminals.

The-s< stage job > The process identification code for the specified stage job, and lists the status of the process under which the job is attached.

s uses process signal format to display process status.

S lists processes, including broken child process data.

The-t< terminal number > Specifies the terminal number, and lists the status of the process belonging to the terminal.

t< Terminal number > The effect of this parameter is the same as the specified "-t" argument, only slightly different in the list format.

-T displays all processes under the current terminal.

-u< User ID > The effect of this parameter is the same as the specified "-u" argument.

U Displays the status of the process in a user-oriented format.

-u< User ID > list The status of the process belonging to the user, or you can specify it by using the user name.

u< User name > Lists the status of the process that belongs to the user.

V uses virtual memory format to display process status.

The-V or V displays version information.

-W or W uses a broad format to display the process status.

X shows all processes and is not differentiated by terminals.

X uses legacy Linux i386 login format to display process status.

When used with the-y coordinate parameter "-L", the f (flag) field is not displayed and the addr field is replaced with an RSS field

-< Process identifier > The effect of this parameter is the same as the specified "P" parameter.

--cols< the number of characters per column > set the maximum number of characters per column.

--columns< the number of characters per column > The effect of this parameter is the same as the specified "--cols" parameter.

--cumulative the effect of this parameter is the same as the specified "S" parameter.

--deselect the effect of this parameter is the same as the specified "-n" parameter.

--forest the effect of this parameter is the same as the specified "F" parameter.

--headers the title column repeatedly.

--help online Help.

--info Display error information.

--lines< Displays the number of columns > sets the number of columns to display the screen.

--no-headers the effect of this parameter is the same as the specified "h" parameter, only slightly different in the list format.

--group< Group name > The effect of this parameter is the same as the specified "-g" argument.

--group< Group identifier > The effect of this parameter is the same as the specified "-G" parameter.

--pid< Process identifier > The effect of this parameter is the same as the specified "-P" argument.

--rows< Displays the number of columns > The effect of this parameter is the same as the specified "--lines" parameter.

The--sid< stage job > The effect of this parameter is the same as the specified "-S" parameter.

--tty< Terminal number > The effect of this parameter is the same as the specified "-T" parameter.

--user< User name > The effect of this parameter is the same as the specified "-u" argument.

--user< User ID > The effect of this parameter is the same as the specified "-u" argument.

--version the effect of this parameter is the same as the specified "-V" argument.

--widty< the number of characters per column > The effect of this parameter is the same as the specified "-cols" parameter.

Example 1

The code is as follows:

[Root@localhost ~]# ps-e #显示所有进程

PID TTY Time CMD

1? 00:00:00 Init

2? 00:00:00 migration/0

3? 00:00:00 ksoftirqd/0

6} 00:00:00 watchdog/0

5? 00:00:00 MIGRATION/1

6? 00:00:00 KSOFTIRQD/1

.....

The code is as follows:

[Root@localhost ~]# PS aux #不区分终端, showing all processes for all users

USER PID%cpu%mem VSZ RSS TTY STAT START time COMMAND

Root 4535 0.0 0.5 64340 11208? S 18:59 0:00/usr/libexec/notification-daemon

Root 4538 2.8 0.4 51116 8712 pts/2 sl+ 18:59 0:44 mplayer/mnt/usb/music/20080625211631.mp3/mnt/usb/music/46250194.mp3/m Nt

Root 4568 0.6 1.1 99516 24752? S 19:05 0:07 gedit FILE:///ROOT/DESKTOP/CSF

Root 4624 0.0 0.0 5888 1476 PTS/3 Ss 19:13 0:00 Bash

Root 4693 6.3 0.7 60096 15612? SN 19:25 0:00/usr/bin/python-tt/usr/libexec/yum-updatesd-helper--check--dbus

.....

The code is as follows:

[Root@localhost ~]# Ps-ef #显示所有进程的UID, Ppip,c and Stime fields

UID PID PPID C stime TTY time CMD

Root 1 0 0 18:24? 00:00:00 Init [3]

Root 2 1 0 18:24? 00:00:00 [migration/0]

Root 3 1 0 18:24? 00:00:00 [ksoftirqd/0]

Root 4 1 0 18:24? 00:00:00 [watchdog/0]

Root 5 1 0 18:24? 00:00:00 [MIGRATION/1]

......

The code is as follows:

[Root@localhost ~]# ps-u zhangy #显示zhangy用户的所有进程

PID TTY Time CMD

3804? 00:00:00 httpd

3805? 00:00:00 httpd

3806? 00:00:00 httpd

3807? 00:00:00 httpd

3808? 00:00:00 httpd

3809? 00:00:00 httpd

3810? 00:00:00 httpd

3811? 00:00:00 httpd

Example 2

The code is as follows:

# PS Axo pid,comm,pcpu//view process PID, name, and CPU usage

# PS Axo pid,comm,pcpu--sort=pcpu//Sort parameter to Pcpu object to

Example 3

The code is as follows:

[Root@localhost ~]# ps-ef|grep rpc.rstatd #查找rpc. RSTATD process

Root 28817 21271 0 15:14 pts/0 00:00:00 grep rpc.rstatd

Example 4

The code is as follows:

# PS-EFL #查看线程数

Example 5

The code is as follows:

# PS-E-O '%c:%p:%z:%a ' |sort-k5-nr #查看进程并按内存使用大小排列

Gitps

The Gitps command is used to display process status, has a visual interface, and is more conducive to operation

A Show all process information

C shows only the real name of the process

E Show Environment variables

F shows the relationship between processes

n is represented by numbers

V in the form of virtual memory display

X does not differentiate between terminals

u< User > specified user

p< Process number > specified process

t< Terminals > designated Terminals

Cases:

The code is as follows:

[Root@localhost download]# gitps-a #显示所有进程

Related Article

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.