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

相关推荐
杜子不疼.6 小时前
【Linux】库制作与原理(二):动态库的制作与使用
linux·运维·服务器
森焱森6 小时前
嵌入式硬件工程师应知 白银快速分析报告
linux·c语言·arm开发·嵌入式硬件·去中心化
RisunJan6 小时前
Linux命令-lpq(查看打印队列状态)
linux·运维·服务器
山君爱摸鱼6 小时前
Linux-服务进程
linux·运维·服务器
阿乐艾官6 小时前
【linux文件系统重要目录及命令解释】
linux·运维·服务器
blueSatchel6 小时前
U-Boot启动后做的事情
linux·u-boot
senijusene6 小时前
Linux软件编程: Linux 操作系统基础与shell脚本
linux·运维·chrome
予枫的编程笔记6 小时前
【Linux进阶篇】Linux后台运行避坑指南:nohup、& 用法及Systemd守护进程实操
linux·进程管理·linux运维·nohup·systemctl·ps命令·kill命令
code monkey.6 小时前
【Linux之旅】Linux 进程间通信(IPC)全解析:从管道到共享内存,吃透进程协作核心
linux·c++·ipc
匆匆那年9676 小时前
llamafactory推理消除模型的随机性
linux·服务器·学习·ubuntu