当前位置:网站首页>Process scheduling and termination
Process scheduling and termination
2022-07-05 01:46:00 【*_ Flowers are not strangers_*】
One . The main command tool for process scheduling and termination
1. Command line &: Run the command line in the background
2.Ctrl + z Composite key : Suspend current process ( Pause and go backstage )
3.jobs: List the background tasks of the current terminal of the current user
4.bg Number : Start the background task with the specified number
5.fg Number : Transfer the background task with the specified number into the foreground to run
6.kill [-9] PID...: Kill designated PID Value process
7.kill [-9] %n: Kill No n A backstage task
8killall [-9] Process name ...: Kill all processes with the specified name
9.pkill: Kill the process according to the specified name or condition
Two . Case study
1. Kill designated PID process
[[email protected] ~]# sleep 1000 & # Open in the background sleep Mission
[1] 76672
[[email protected] ~]# ps aux | grep sleep # Filter process information ( The second as PID)
root 76672 0.0 0.0 107948 352 pts/0 S 23:28 0:00 sleep 1000
root 76740 0.0 0.0 112704 960 pts/0 R+ 23:28 0:00 grep --color=auto sleep
[[email protected] ~]# kill -9 76672 # Kill designated PID process
[[email protected] ~]# jobs #sleep The process has been killed
[1]+ Killed sleep 1000
2. Kill multiple processes according to the process name
# step 1: Open multiple in the background vim process
[[email protected] ~]# vim a.txt &
[1] 77890
[[email protected] ~]# vim b.txt &
[2] 77915
[1]+ Stopped vim a.txt
[[email protected] ~]# vim c.txt &
[3] 77944
[2]+ Stopped vim b.txt
# step 2: Confirm the process information
[[email protected] ~]# jobs
[1] Stopped vim a.txt
[2]- Stopped vim b.txt
[3]+ Stopped vim c.txt
# step 3: Force to kill all people named vim The process of
[[email protected] ~]# killall -9 vim
# step 4: Confirm that the process is killed
[[email protected] ~]# jobs
[1] Killed vim a.txt
[2]- Killed vim b.txt
[3]+ Killed vim c.txt
3. Kill all processes belonging to the specified user
step 1: Log in to test user
[[email protected] ~]# useradd test # Create user
[[email protected] ~]# su - test # Switch to test user
[[email protected] ~]$
step 2: Create a new terminal to manage root Sign in , Search for users test The process of
[[email protected] ~]# pgrep -u test # Retrieve the user's PID
84860
[[email protected] ~]# pstree -up 84860 # Check the process tree
bash(84860,test)
# step 3: Force to kill the process belonging to the user
[[email protected] ~]# pkill -9 -u test # Kick out the logged in user test
# step 4: Return to the original test terminal , Confirmation has been terminated
[[email protected] ~]$ Killed
边栏推荐
- MySQL regexp: Regular Expression Query
- 微信小程序:微群人脉微信小程序源码下载全新社群系统优化版支持代理会员系统功能超高收益
- 如何搭建一支搞垮公司的技術團隊?
- 微信小程序:最新wordpress黑金壁纸微信小程序 二开修复版源码下载支持流量主收益
- Mysql database | build master-slave instances of mysql-8.0 or above based on docker
- [swagger]-swagger learning
- Game 280 of leetcode week
- Five ways to query MySQL field comments!
- C语音常用的位运算技巧
- Nebula importer data import practice
猜你喜欢
Yyds dry goods inventory [Gan Di's one week summary: the most complete and detailed in the whole network]; detailed explanation of MySQL index data structure and index optimization; remember collectio
How to safely eat apples on the edge of a cliff? Deepmind & openai gives the answer of 3D security reinforcement learning
Wechat applet: new independent backstage Yuelao office one yuan dating blind box
Codeforces Global Round 19 ABC
Four pits in reentrantlock!
微信小程序:独立后台带分销功能月老办事处交友盲盒
Nebula Importer 数据导入实践
Mysql database | build master-slave instances of mysql-8.0 or above based on docker
Do you know the eight signs of a team becoming agile?
Five ways to query MySQL field comments!
随机推荐
Huawei machine test question: longest continuous subsequence
Kibana installation and configuration
JVM's responsibility - load and run bytecode
Application and development trend of image recognition technology
Outlook:总是提示输入用户密码
官宣!第三届云原生编程挑战赛正式启动!
小程序容器技术与物联网 IoT 可以碰撞出什么样的火花
[Chongqing Guangdong education] National Open University spring 2019 1042 international economic law reference questions
Database postragesql client connection default
Exploration and Practice of Stream Batch Integration in JD
MySQL REGEXP:正则表达式查询
JVM - when multiple threads initialize the same class, only one thread is allowed to initialize
Restful Fast Request 2022.2.1发布,支持cURL导入
Wechat applet: independent background with distribution function, Yuelao office blind box for making friends
Introduction to redis (1)
DOM basic syntax
Valentine's Day flirting with girls to force a small way, one can learn
MySQL regexp: Regular Expression Query
Win:使用组策略启用和禁用 USB 驱动器
线上故障突突突?如何紧急诊断、排查与恢复