4 ways to view processes in LINUX (summary)

4 ways to view processes in LINUX (summary)

A process is a program code that runs in the CPU and memory, and each process can create one or more processes (parent and child processes).

**View process method:**

The first one:

ps aux

The ps command is used to report the process status of the current system. You can use the kill command to interrupt and delete unnecessary programs at any time. The ps command is the most basic and also very powerful process viewing command. This command can be used to determine which processes are running and their running status, whether the processes have ended, whether the processes are dead, which processes are occupying too many resources, etc. In short, most of the information can be obtained by executing this command.

a: Display all process information under the current terminal, including processes of other users.

u: Output process information in user-centric format.

x: Display the processes of the current user in all terminals.

Example:

**Explanation of the fields in the above figure:**

USER: The name of the user account that started the process
PID: The ID number of the process, which is unique in the current system
%CPU: The percentage of CPU usage
%MEM: Percentage of memory used

VSZ: The size of virtual memory (swap space) occupied
RSS: The size of the resident memory (physical memory) occupied

TTY: The terminal on which the process is running. "?" indicates unknown or unnecessary terminal
STAT: Displays the current status of the process, such as S (sleeping), R (running), Z (zombie), < (high priority), N (low priority), s (parent process), + (foreground process). Processes in a zombie state should be terminated manually.

START: The time when the process was started
TIME: The CPU time occupied by the process
COMMAND: The name of the command that started the process

**Summary: ps aux displays process information in the form of a simple list. **

Second type:

ps -elf

-e: Display all process information in the system.

-l: Display process information in long format.

-f: Display process information using full format.

Explanation of the fields in the above figure:
Most of them are the same as the first one, where PPID is the PID of the parent process.

The third type:

top

It displays the process ranking in a full-screen interactive interface, and tracks the usage of system resources including CPU and memory in a timely manner. It refreshes every three seconds by default. Its function is basically similar to the Task Manager in the Windows system.

Explanation of the above picture:

Tasks (system tasks) information: total, the total number of processes; running, the number of running processes; sleeping, the number of dormant processes; stopped, the number of terminated processes; zombie, the number of zombie and unresponsive processes.

CPU information: us, user occupancy; sy, kernel occupancy; ni, priority scheduling occupancy; id, idle CPU; wa, I/O wait occupancy; hi, hardware interrupt occupancy; si, software interrupt occupancy; st, virtualization occupancy. To understand the idle CPU percentage, look at the %id part.

Mem (memory) information: total, total memory space; used, used memory; free, free memory; buffers, cache area.

Swap (swap space) information: total, total swap space; used, used swap space; free, free swap space; cached, cache space.

The fourth type:

pstree -aup

The derivation relationship between processes is displayed in a tree diagram, which has a more intuitive display effect.
-a: Displays the complete instructions for each program, including the path, parameters or the mark of the resident service;
-c: Do not use the simplified notation method;
-G: Use the column drawing characters of the VT100 terminal;
-h: When listing the tree diagram, specially mark the currently executed program;
-H<program identification code>: The effect of this parameter is similar to specifying the "-h" parameter, but specifically indicates the specified program;
-l: Display the tree diagram in long column format;
-n: Sort by program identification code. The default is to sort by program name;
-p: Display program identification code;
-u: Display user name;

This concludes the article about 4 ways to view processes in LINUX (summary). For more information about viewing processes in LINUX, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Linux method example to view all information of the process
  • View the port number occupied by the process in Linux
  • How to view process stack information in Linux
  • How to view the number of file handles opened by a process and how to modify them in Linux
  • In-depth understanding of viewing process memory usage under Linux

<<:  Eight examples of how Vue implements component communication

>>:  How to delete a MySQL table

Recommend

How to use module fs file system in Nodejs

Table of contents Overview File Descriptors Synch...

VMware Workstation 12 Pro Linux installation tutorial

This article records the VMware Workstation 12 Pr...

MySQL 4 common master-slave replication architectures

Table of contents One master and multiple slaves ...

Encapsulate the navigation bar component with Vue

Preface: Fully encapsulating a functional module ...

Why is there this in JS?

Table of contents 1. Demand 2. Solution 3. The fi...

How to preview pdf file using pdfjs in vue

Table of contents Preface think Library directory...

Implementation and usage scenarios of JS anti-shake throttling function

Table of contents 1. What is Function Anti-shake?...

Linux completely removes node.js and reinstalls it through the yum command

first step Delete it once with the built-in packa...

Implementation of CSS text shadow gradually blurring effect

text-shadow Add a shadow to the text. You can add...

JavaScript implements simple date effects

The specific code of JavaScript date effects is f...

How to solve the 2002 error when installing MySQL database on Alibaba Cloud

The following error occurred while installing the...