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 word "process" of production environment

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

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

I. the concept of process

A copy of a running program is an instruction set process ID (Process ID,PID) number loaded into memory that is used to mark the context of each process UID, GID, and SELinux to determine access and access to the file system, usually inheriting the lifecycle from the user executing the process.

II. Process status

1) running status: running

2) ready state: ready

3) Sleep can be interrupted

4) Sleep is uninterruptible

5) stop state stopped 6) dead state zombie

III. Process management commands

Linux system status viewing and management tools: pstree, ps, pidof, pgrep, top, htop, glance, pmap, vmstat, dstat, kill, pkill, job, bg, fg, nohup

The relevant information of each process in the Linux system is stored in the files in the / proc/PID directory.

Pstree command:

Pstree-display a tree of processes

Ps command:

Ps-report a snapshot of the current processes

Ps [OPTION]...

-e: shows that all processes are equivalent to-a

-a: shows that all processes are equivalent to-e

-f: option to display the parent process of its process

-u: option to display owner information

-x: includes processes that do not link terminals

-o: specify attributes to display: pid,comm,%cpu,%mem,state,tty,euser (effective user), ruser (real user)

VSZ:Virtual Memory Size, virtual memory set

RSS: resident memory set (physical memory set)

Stat status:

R:running

S:interruptable sleeping

D:uninterruptable sleeping

T:stopped

Z:zombie

Common combination:-ef

-e: show all processes

-f: displays the full format program information

Common combination:-eFH

-F: displays process information in a more complete format

-H: displays process-related information in a process-level format

Common combinations: custom-eo pid,tid,class,rtprio,ni,pri,psr, pcpu,stat,comm axo stat,euid,ruid,tty,tpgid,sess,pgrp,ppid, pid,pcpu,comm

Ni:nice value pri:priority, priority psr:processor,cpu number

Rtprio: real-time priority

Pgrep command:

Pgrep [options] pattern

Options:

-u:uid, the effector of the process

-U:real user, the real initiator of running the command

-t:terminal, terminal-related processes

-l: displays the process name

-a: displays the process name in full format

-P:pid, showing the children of the specified process

According to the exact program name: / sbin/pidof pidof bash

III. Process management tools

Top:

Htop:

Column information:

Us:user

Space: user space

Sy: kernel space

Ni:nice value

Wa: wait for I0 time

Id: idle

Hi: hard interrupt

Si: soft interrupt

St: time stolen by the stolen virtual machine

Process related parameters description:

PID: the process number of the task

PPID: the process number of the parent process of the process

RUSER: the owner of the process

EUSER: the effective user of the process

TTY: terminal

PR: priority

% share of CPU:CPU

% MEM: memory share

S: process statu

TIME+:CPU working hours

Top: there are many built-in commands for processes

1) sort

P:% cpu as a percentage of cpu occupied

M: percentage of memory,% MEM

T: cumulative occupation of cpu duration time

2) header information

Uptime information: l command

Tasks and cpu information: t command

Memory information: M command

3) exit command: Q

Modify refresh time: s

Terminate the specified process: K

Save file: W

Kill command: sends a process control signal to the process to manage the process.

1) SIGHUB: reread the configuration file without shutting down the process

2) SIGINT: aborts a running process

9) SIGKILL: kill a running process

15) SIGTEM: abort the running process, let it finish, and kill again

18) SIGCONT: continue to run

19) SIGSTOP: background hibernation

How to specify the signal:

(1) Digital identification of the signal; 1, 2, 9

(2) full name of the signal; SIGHUP

(3) the abbreviated name of the signal; HUP

How to kill a process:

Press PID:kill [- SIGNAL] pid...

By name: killall [- SIGNAL] COMM

By mode: pkill [options] pattern

-SIGNAL

-u uid:effective user effector

-t:terminal: the process related to the specified terminal

-l: displays the process name

-a: displays the process name in full format

-P:pid displays a list of processes for the processes specified here by the parent process

Source: Ma GE Education

Official Wechat: magedu-linux

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

Network Security

Wechat

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

12
Report