systemctl 常用命令备忘

来源:互联网 发布:烈焰遮天 源码 双端 编辑:程序博客网 时间:2024/06/14 09:06

使用Systemctl控制并管理服务

列出所有服务(包括启用的和禁用的)
# systemctl list-unit-files --type=service
查看某个服务
# systemctl list-unit-files --type=service | grep nginx

启动、重启、停止、重载服务以及检查服务(如 httpd.service)状态
# systemctl start httpd.service
# systemctl restart httpd.service
# systemctl stop httpd.service
# systemctl reload httpd.service
# systemctl status httpd.service

激活服务并在启动时启用或禁用服务(即系统启动时自动启动服务)
# systemctl is-active httpd.service
# systemctl enable httpd.service
# systemctl disable httpd.service

屏蔽(让它不能启动)或显示服务(如 httpd.service)
# systemctl mask httpd.service
# systemctl unmask httpd.service

使用systemctl命令杀死服务
# systemctl kill httpd

使用Systemctl控制并管理挂载点

列出所有系统挂载点
# systemctl list-unit-files --type=mount

挂载、卸载、重新挂载、重载系统挂载点并检查系统中挂载点状态
# systemctl start tmp.mount
# systemctl stop tmp.mount
# systemctl restart tmp.mount
# systemctl reload tmp.mount
# systemctl status tmp.mount

在启动时激活、启用或禁用挂载点(系统启动时自动挂载)
# systemctl is-active tmp.mount
# systemctl enable tmp.mount
# systemctl disable  tmp.mount

在Linux中屏蔽(让它不能启用)或可见挂载点
# systemctl mask tmp.mount
ln -s '/dev/null' '/etc/systemd/system/tmp.mount'
# systemctl unmask tmp.mount
rm '/etc/systemd/system/tmp.mount'



原创粉丝点击