Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The use of ps Command and gitps Command in Linux system

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "the use of ps commands and gitps commands in the Linux system". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Ps

Ps [- aAcdefHjlmNVwy] [acefghLnrsSTuvxX] [- C] [- g]

[- G] [- p] [p] [- s]

[- t] [t] [- u] [- U]

[U] [-] [--cols]

[- columns] [--cumulative] [--deselect] [--forest]

[--headers] [--help] [--info] [--lines] [--no-headers]

[--group] [- Group] [--pid]

[--rows] [--sid] [--tty]

[--user] [--User] [--version]

[--width]

Parameter description:

-a displays the processes executed under all terminals, except for the phase job leader.

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

-A shows all processes.

-c displays the CLS and PRI fields.

C when listing processes, displays the real instruction name of each process, without the identification of paths, parameters, or resident services.

-C specifies the name of the execution instruction and lists the status of the process in which the instruction is executed.

-d shows all processes, excluding those of phase operation leaders.

-e this parameter has the same effect as specifying the "A" parameter.

E when listing processes, displays the environment variables used by each process.

-f displays the UID,PPIP,C and STIME fields.

F displays the tree structure with ASCII characters to express the relationship between processes.

-g the effect of this parameter is the same as that of specifying the "- G" parameter, and can also be specified using the name of the phase operation leader.

G shows all processes under the current terminal, including those of group leaders.

-G lists the status of the processes that belong to the group, or you can specify it using the group name.

H does not display the title column.

-H displays a tree structure, indicating 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 lists the relevant information about the field.

-m or m displays all threads.

N represents the USER and WCHAN fields with numbers.

-N displays all processes except those under the terminal that execute ps instructions.

-p specifies the process identifier and lists the status of the process.

P this parameter has the same effect as specifying the "- p" parameter, except for a slight difference in the list format.

R lists only the processes that are being executed by the current terminal.

-s specifies the process identifier of the phase job and lists the status of the processes belonging to the phase job.

S displays the status of the process in the format of process signals.

S lists processes, including interrupted child process information.

-t specifies the terminal number and lists the status of the processes that belong to the terminal.

The effect of this parameter is the same as that of specifying the "- t" parameter, except for a slight difference in list format.

-T displays all processes under the current terminal.

-u this parameter has the same effect as specifying the "- U" parameter.

U displays the process status in a user-based format.

-U lists the status of the processes that belong to the user, or you can specify it using the user name.

U lists the status of the processes that belong to the user.

V displays the process status in the format of virtual memory.

-V or V displays version information.

-w or w shows the status of the process in a broad format.

X displays all processes, not distinguished by terminals.

X uses the old Linux i386 login format to show the progress.

When-y is used with the parameter "- l", the F (flag) field is not displayed, and the ADDR field is replaced by the RSS field.

-the effect of this parameter is the same as specifying the "p" parameter.

-- cols sets the maximum number of characters per column.

-- columns this parameter has the same effect as specifying the "--cols" parameter.

-- cumulative this parameter has the same effect as specifying the "S" parameter.

-- deselect this parameter has the same effect as specifying the "- N" parameter.

-- forest this parameter has the same effect as specifying the "f" parameter.

-- headers displays the title column repeatedly.

-- help online help.

-- info displays troubleshooting messages.

-- lines sets the number of columns in the display screen.

-- no-headers this parameter has the same effect as specifying the "h" parameter, except for slight differences in list format.

-- group this parameter has the same effect as specifying the "- G" parameter.

-- Group this parameter has the same effect as specifying the "- G" parameter.

-- pid this parameter has the same effect as specifying the "- p" parameter.

-- rows this parameter has the same effect as specifying the "--lines" parameter.

-- sid this parameter has the same effect as specifying the "- s" parameter.

-- tty this parameter has the same effect as specifying the "- t" parameter.

-- user this parameter has the same effect as specifying the "- U" parameter.

-- User this parameter has the same effect as specifying the "- U" parameter.

-- version this parameter has the same effect as specifying the "- V" parameter.

-- widty this parameter has the same effect as specifying the "- cols" parameter.

Example 1

The code is as follows:

[root@localhost ~] # ps-e # shows all processes

PID TTY TIME CMD

1? 00:00:00 init

2? 00:00:00 migration/0

3? 00:00:00 ksoftirqd/0

4? 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 # does not distinguish between terminals and displays all processes of 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 / mnt

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 # displays the UID,PPIP,C and STIME fields of all processes

UID PID PPID C STIME TTY TIME CMD

Root 1 00 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 # shows all processes of zhangy users

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 the PID, name and CPU occupancy of the process

# ps axo pid,comm,pcpu-- sort=pcpu / / sort parameter pair with pcpu as object

Example 3

The code is as follows:

[root@localhost ~] # ps-ef | grep rpc.rstatd # find the 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 # View the number of threads

Example 5

The code is as follows:

# ps-e-o "% C:% p:% z:% a" | sort-K5-nr # View processes and arrange them by memory usage

Gitps

The gitps command is used to show the status of the process. It has a visual interface and is more convenient for operation.

A displays all process information

C displays only the real name of the process

E display environment variables

F shows the relationship between processes

N is represented by numbers

V display in the form of virtual memory

X does not distinguish between terminals

U specified user

P specify process

T designated terminal

Example:

The code is as follows:

[root@localhost download] # gitps-a # shows all processes

This is the end of the introduction to "the use of ps commands and gitps commands in the Linux system". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report