[Linux] Linux practical operation---process management (important)

Process management


(1) Basic introduction

Insert picture description here


(2) Display the process executed by the system

① Basic introduction

Insert picture description here


② ps detailed explanation

Insert picture description here


Insert picture description here

Insert picture description here


③ Application examples

Insert picture description here


(3) Terminate the process kill and killall

① Introduction

Insert picture description here


② Basic grammar

Insert picture description here


③ Common options

Insert picture description here


④ Best practice

Case 1: Kick off an illegal login user

Insert picture description here


Case 2: Terminate the remote login service sshd, and restart the sshd service again at an appropriate time

Find the remote login process in the CentOS terminal and terminate the process
Insert picture description here

Disconnected in XShell
Insert picture description here


Case 3: Terminate multiple gedit editors

Insert picture description here


Case 4: Forcibly kill a terminal

Insert picture description here


(4) View the process tree pstree

① Basic grammar and common options

Insert picture description here


② Application examples

Case 1: Please display the pid of the process in the form of a tree

Insert picture description here


Case 2: Please use the user id of the process in the form of a tree

Insert picture description here


(5) Service management

① Introduction

Insert picture description here

Insert picture description here


② Service management instructions

Insert picture description here


③ Application case

Case: Check the current firewall status, turn off the firewall and restart the firewall.

Insert picture description here


④ Detailed discussion

Insert picture description here


⑤ View service name:

Method 1: Use setup-system services can be seen.

Insert picture description here

Insert picture description here
Insert picture description here


Method 2: /etc/init.d/service name

Insert picture description here


⑥ The runlevel of the service (runlevel):

Insert picture description here
Insert picture description here


Insert picture description here


⑦ chkconfig command

Insert picture description here


Case 1: Please display the running status of all running levels of all services in the current system

Insert picture description here


Case 2: Please check the running status of the sshd service

Insert picture description here


Case 3: Set the sshd service to not start automatically under run level 5, and see what effect does it have?

Insert picture description here


Case 4: When the run level is 5, turn off the firewall.

Insert picture description here


Case 5: In all run levels, turn off the firewall

Insert picture description here


Case 6: In all run levels, turn on the firewall

Insert picture description here


Insert picture description here


(6) Dynamic monitoring process

① Introduction

Insert picture description here


② Basic grammar

Insert picture description here

Insert picture description here


③ Interactive operation instructions

Insert picture description here


④ Application examples:

Case 1. Monitoring a specific user
top:输入此命令,按回车键,查看执行的进程。

u:然后输入“u”,再输入用户名,即可

Insert picture description here

Insert picture description here


Case 2: Terminate the specified process.
top:输入此命令,按回车键,查看执行的进程。

k:然后输入“k”,再输入要结束的进程ID号

Insert picture description here


Case 3: Specify the system status update time (automatically update every 10 seconds):
top -d 10

Insert picture description here


(7) Monitor network status

① Check system network status netstat

Insert picture description here


Case 1: Check the information of the service whose service name is sshd.

Insert picture description here


② Check the host connection command ping:

Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_45260385/article/details/114487889