【Ubuntu】systemctl 命令

systemctl 是一个用于检视和控制 systemd 系统和服务管理器的命令行工具。systemd 是用于启动、停止和管理 Linux 系统中的服务的守护进程。以下是一些常用的 systemctl 命令及其说明:

  1. **systemctl start <unit>:**启动指定的服务单元

    bash 复制代码
    systemctl start sshd
  2. **systemctl stop <unit>:**停止指定的服务单元

    bash 复制代码
    systemctl stop sshd
  3. **systemctl restart <unit>:**重新启动指定的服务单元

    bash 复制代码
    systemctl restart sshd
  4. **systemctl status <unit>:**显示指定服务单元的当前状态信息

    bash 复制代码
    systemctl status sshd
  5. **systemctl enable <unit>:**将指定的服务单元设置为在系统启动时自动启用

    bash 复制代码
    systemctl enable sshd
  6. **systemctl disable <unit>:**将指定的服务单元设置为在系统启动时自动禁用

    bash 复制代码
    systemctl disable sshd
  7. **systemctl is-active <unit>:**检查指定的服务单元是否处于活动状态(运行中)

    bash 复制代码
    systemctl is-active sshd
  8. **systemctl is-enabled <unit>:**检查指定的服务单元是否已启用(开机自启)

    bash 复制代码
    systemctl is-enabled sshd
  9. systemctl daemon-reload: 重新加载 systemd 管理的服务单元,以便识别最新的配置更改

    bash 复制代码
    systemctl daemon-reload

这些命令提供了对 systemd 系统和服务的广泛管理功能。你可以使用 man systemctl 命令查看 systemctl 命令的手册页面,获取更详细的信息。

相关推荐
一位摩羯座DBA2 小时前
Redhat&Centos挂载镜像
linux·运维·centos
学习3人组2 小时前
CentOS配置网络
linux·网络·centos
weixin_307779132 小时前
Hive集群之间迁移的Linux Shell脚本
大数据·linux·hive·bash·迁移学习
漫步企鹅3 小时前
【蓝牙】Linux Qt4查看已经配对的蓝牙信息
linux·qt·蓝牙·配对
cui_win3 小时前
【网络】Linux 内核优化实战 - net.core.flow_limit_table_len
linux·运维·网络
梦在深巷、3 小时前
MySQL/MariaDB数据库主从复制之基于二进制日志的方式
linux·数据库·mysql·mariadb
冰橙子id4 小时前
linux系统安全
linux·安全·系统安全
stark张宇4 小时前
VMware 虚拟机装 Linux Centos 7.9 保姆级教程(附资源包)
linux·后端
Johny_Zhao4 小时前
Ubuntu系统安装部署Pandawiki智能知识库
linux·mysql·网络安全·信息安全·云计算·shell·yum源·系统运维·itsm·pandawiki
悲伤小伞4 小时前
linux_git的使用
linux·c语言·c++·git