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

相关推荐
tntxia14 小时前
linux curl命令详解_curl详解
linux
扛枪的书生16 小时前
Linux 网络管理器用法速查
linux
顺风尿一寸19 小时前
Java Socket 内核之旅:从 SocketChannel.read() 到 tcp_recvmsg 与 epoll 的完整调用链路
linux
XIAOHEZIcode1 天前
Ubuntu 终端美化全栈指南:Bash 到 Kitty 踩坑实录
linux·ubuntu·命令行
唐青枫1 天前
别再只会用 cron:Linux systemd Timer 定时任务实战详解
linux
AlfredZhao3 天前
生产环境里,为什么不建议把普通端口直接暴露到公网?
linux·https·443·80
戴为沐4 天前
Linux内存扩容指南
linux
zylyehuo4 天前
Linux 彻底且安全地删除文件
linux
用户805533698035 天前
主线 U-Boot 上 RK3506:和闭源 rkbin 拔河的三个隐性契约
linux·嵌入式
用户034095297915 天前
linux fcitx 5 雾凇拼音 设置在中文输入法下仍然输入英文标点
linux