systemctl [start | stop | restart | status] 服务名
systemctl
指令管理的服务在 /usr/lib/systemd/system
查看
systemctl list-unit-files [ | grep 服务名]
(查看服务开机启动状态, grep
可以进行过滤)
systemctl enable 服务名
(设置服务开机启动),对 3
(无界面)和 5
(GUI)运行级别都生效systemctl disable 服务名
(关闭服务开机启动),对 3
(无界面)和 5
(GUI)运行级别都生效systemctl is-enabled 服务名
(查询某个服务是否是自启动的)
firewalld.service
(服务名)
可以写一半再查看完整的服务名,一般也可以简写:firewalld.service = firewall
systemctl status firewalld
systemctl stop firewalld
systemctl start firewalld
systemctl start/stop firewalld
)开启或关闭某个服务只是临时生效,当重启系统后,还是回归以前对服务的设置。systemctl [enable|disable] 服务名
systemctl is-enabled 服务名
(查询某个服务是否是自启动的) 命令查看这个服务是不是自启动的状态
systemctl stop firewalld
关闭防火墙,发现还是处于自启动状态。
systemctl disable firewalld
时,下次重启系统时防火墙还是处于关闭的状态