diff --git "a/07\351\203\221\345\255\220\346\235\260/2024\345\271\26406\346\234\21019\346\227\245\347\254\224\350\256\260-linux\345\237\272\347\241\20018(\350\277\233\347\250\213\347\256\241\347\220\206).md" "b/07\351\203\221\345\255\220\346\235\260/2024\345\271\26406\346\234\21019\346\227\245\347\254\224\350\256\260-linux\345\237\272\347\241\20018(\350\277\233\347\250\213\347\256\241\347\220\206).md" new file mode 100644 index 0000000000000000000000000000000000000000..90bb4a20ae1f992c5a0a422176befad73e5b7bfa --- /dev/null +++ "b/07\351\203\221\345\255\220\346\235\260/2024\345\271\26406\346\234\21019\346\227\245\347\254\224\350\256\260-linux\345\237\272\347\241\20018(\350\277\233\347\250\213\347\256\241\347\220\206).md" @@ -0,0 +1,31 @@ +# linux进程管理 + + +1. ps - ef | grep - 列出需要进程 + ps -aux - 显示进程信息,如无终端的(x)和针对用户(u)的进程:如USER,PID,%CPU等 + ps -e --forest 以树形结构显示进程关系 +2. pstree +3. top:实时显示系统中各个进程的资源占用情况 +4. htop:比top更高级的进程查看器,提供颜色编码和更直观的界面 +5. pkill:根据进程名杀死进程 +6. pgrep:查看匹配条件的进程。例如,pgrep -f httpd可以查找命令行中包含httpd的进程 +7. jobs:显示当前shell会话中的作业状态 +8. bg:将一个暂停(stopped)的作业放在后台执行 +9. fg:将后台作业调至前台并继续执行 +10.nohup:在用户注销后继续运行命令 + + + +服务管理 +1.systemctl + - 启动 systemctl start 服务名 + - 停止 systemctl stop 服务名 + - 重启 systemctl restart 服务名 + - 查看 systemctl status 服务名 + - 重新加载配置文件 systemctl reload 服务名 + +2.service + - 启动 service 服务名 start + - 停止 service 服务名 stop + - 重启 service 服务名 restart + - 查看 service 服务名 status diff --git "a/07\351\203\221\345\255\220\346\235\260/2024\345\271\26406\346\234\21022\346\227\245\347\254\224\350\256\260-linux\345\237\272\347\241\20019(\346\234\215\345\212\241).md" "b/07\351\203\221\345\255\220\346\235\260/2024\345\271\26406\346\234\21022\346\227\245\347\254\224\350\256\260-linux\345\237\272\347\241\20019(\346\234\215\345\212\241).md" new file mode 100644 index 0000000000000000000000000000000000000000..291d3c97c843e211c18f5825547a07995b31add8 --- /dev/null +++ "b/07\351\203\221\345\255\220\346\235\260/2024\345\271\26406\346\234\21022\346\227\245\347\254\224\350\256\260-linux\345\237\272\347\241\20019(\346\234\215\345\212\241).md" @@ -0,0 +1,13 @@ +# linux 服务 +- 服务一般会监听某个端口 +- 命令 + - 开启:start + - 关闭:stop + - 重启:restart + - 查看状态:status + - 重加载:reload + - 开机自启动:enable/disable + +- systemctl 操作 服务 +- service 操作 服务 +- /etc/init.d/ 操作 服务 \ No newline at end of file