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

How to view the process in Linux system

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces "how to view the process in the Linux system". In the daily operation, I believe that many people have doubts about how to view the process in the Linux system. The editor consulted all kinds of materials and sorted out a simple and easy-to-use method of operation. I hope it will be helpful to answer the doubt of "how to view the process in the Linux system". Next, please follow the editor to study!

Ps command

The ps command is a fairly powerful process view command even in the most fundamental case. Using this command, you can determine which processes are running and running state, whether the process ends, whether the process is dead or not, which processes take up too much resources, and so on. In short, most of the information is available by executing the command.

Ps command and its parameters

The ps command is most frequently used to monitor the operation of background processes, because background processes are not compatible with standard input / output settings such as on-screen keyboards

Be prepared for communication, so if you need to detect the situation, you can use the ps command.

The syntax format of the command is as follows:

Ps [options]

-e displays all processes, environment variables

-f full format

-h does not display the title

-l long format

-w wide output

A

Displays all processes on the terminal, including those of other users

R

Show only running processes

X

Show the process without control terminal

O[ + | -] K1 [, [+ | -] K2 [, …]] Displays a list of processes according to the multi-level sort order specified by the shortcut keys in SHORT KEYS, K1, and K2.

There is a default sequential assignment for different formats of ps. These default orders can be overridden by user assignments. The "+" character is optional and the "-" character reverses the direction of the specified key.

Pids lists only process identifiers, separated by commas. The list of processes must be given immediately after the last option of the command line argument, with no spaces inserted. For example: ps-F1 4pm 5.

The following describes the long command line options, all of which start with "- -":

-- sort X [+ | -] key [, [+ | -] key [, …]] Select a multi-letter key from the SORT KEYS section. The "+" character is optional because the default direction is in ascending numerical or lexicographic order. For example: ps-jax-sort=uid,-ppid,+pid.

-help displays help information.

-- version displays the version information of the command.

The sort key is mentioned in the previous option description, followed by a further explanation of the sort key. It should be noted that the land value used in sorting is the internal value of the ps application, not just for pseudo values in some output formats. The list of sort keys is shown in Table 4-3.

Sort key list

C

Cmd

Executable simple name

C

Cmdline

Complete command line

F

Flags

Long pattern flag

G

Pgrp

Process site group ID

G

Tpgid

Control tty process group ID

J

Cutime

Cumulative user time

J

Cstime

Cumulative system time

K

Utime

User time

K

Stime

System time

M

Min_flt

Secondary page error

Find the Zombie process

First of all, when the desktop program is stuck, you can try to access other tty terminals. Switching mode: ctrl + alt + [1, 2, 3, 4, 5, 5, 6, 7], 7 is the desktop terminal

Second, you can use the top command to see if there is a Zombie process

You can see the number of zombie processes from the above figure. If num zombie,num is greater than 0, it means that there are zombie processes in the system.

Finally, use the ps command to find the Zombie process

The code is as follows:

Ps-A-ostat,ppid,pid,cmd | grep-e'^ [zZ]'

Example:

Kill the Zombie process

Direct kill-9 Zombiepid is useless because Zombie indicates that the process has exited. To clean up such a process, you need to clear its parent process or wait a long time for the kernel to clear it.

The code is as follows:

Kill-HUP ppid

At this point, the study on "how to view the progress in the Linux system" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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