systemctl 管理服务

1. 启动,注销等

#通过systemctl关闭服务
systemctl stop atd.service
#启动
systemctl start atd.service
#查看服务
systemctl status atd.service

2.查看服务

#列出启动的服务
systemctl
#列出安装的服务
systemctl list-unit-files

3. 管理不同的操作环境

#列出跟操作界面有关的target项目
systemctl list-units --type=target --all
#获取目前的target
systemctl get-default
#设置target
systemctl set-default multi-user.target
#不重新启动的情况下,切换操作环境
systemctl isolate graphical.target
#关机
systemctl poweroff
#重新开机
systemctl reboot
#挂起
systemctl suspend
#休眠
systemctl hibernate
#恢复模式
systemctl rescue
# 紧急恢复模式
systemctl emergency

4.查看依赖

#查看依赖
systemctl list-denpendencies
#查看被依赖
systemctl list-denpendencies --reverse

 

5.查看socket服务的文件

#查看socket文件
systemctl list-sockets
#查看协议和端口
cat /etc/services

 

6.关闭网络服务

#查看网络服务
netstat -tlunp
#查找服务
systemctl list-units -all  | grep services
#关闭
systemctl stop services.service
systemctl stop services.socket

 

posted @ 2022-03-29 22:59  随意的马蒂洛克  阅读(170)  评论(0编辑  收藏  举报