【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 命令的手册页面,获取更详细的信息。

相关推荐
随祥9 分钟前
网络开源工具
linux
北京迅为41 分钟前
【北京迅为】iTOP-4412精英版使用手册-第七十八章 Qt界面切换
linux·人工智能·嵌入式·4412
Tipriest_1 小时前
linux中的文本分接流tee命令介绍
linux·服务器·数据库
阿拉伯柠檬1 小时前
MySQL内置函数
linux·数据库·mysql·面试
Xの哲學2 小时前
Linux CFS 调度器深度解析
linux·服务器·算法·架构·边缘计算
大聪明-PLUS2 小时前
关于 systemd 和桌面应用程序自动启动
linux·嵌入式·arm·smarc
松涛和鸣2 小时前
DAY42 SQLite3 : Dictionary Import and Data Query Implementation with C Language
linux·c语言·数据库·单片机·网络协议·sqlite
小馬佩德罗2 小时前
如何将x264 x265的动态库编译入Linux系统中的FFmpeg源码 - x265库编译
linux·ffmpeg·x265
飞Link3 小时前
【Anaconda】Linux(CentOS7)下安装Anaconda教程
linux·运维·python
DigitalOcean3 小时前
Ubuntu/Debian VPS 上 Apache Web 服务器的完整配置教程
ubuntu·apache