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

相关推荐
HEX9CF9 分钟前
【Linux】awk 命令详解及使用示例:结构化文本数据处理工具
linux·chrome·算法
labuladuo52019 分钟前
Linux命令基础(2)
linux
yi个名字32 分钟前
Linux文件系统详解:从入门到精通
linux·运维·服务器
Lw老王要学习2 小时前
Linux容器篇、第二章_01Ubuntu22 环境下 KubeSphere 容器平台高可用搭建全流程
linux·运维·服务器·k8s·kubesphere·容器化
張萠飛2 小时前
Linux下如何使用shell脚本导出elasticsearch中某一个index的数据为本地csv文件
linux·运维·elasticsearch
晓枫-迷麟4 小时前
【nano与Vim】常用命令
linux·编辑器·vim
LucienShui4 小时前
Webhook 配置备忘
linux·运维·webhook
超级土豆粉5 小时前
从0到1写一个适用于Node.js的User Agent生成库
linux·ubuntu·node.js
PH_modest5 小时前
【Linux跬步积累】—— 网络编程套接字(二)
linux·运维·网络
CIb0la5 小时前
Ubuntu 25.10 将默认使用 sudo-rs
linux·程序人生·生活