Linux中systemctl命令详细介绍
Linux Systemctl是一个系统管理守护进程、工具和库的集合,用于取代System V、service和chkconfig命令,初始进程主要负责控制systemd系统和服务管理器。通过Systemctl –help可以看到该命令主要分为:查询或发送控制命令给systemd服务,管理单元服务的命令,服务文件的相关命令,任务、环境、快照相关命令,systemd服务的配置重载,系统开机关机相关的命令。
1. 列出所有可用单元
# systemctl list-unit-files
2. 列出所有运行中单元
# systemctl list-units
3. 列出所有失败单元
# systemctl –failed
4. 检查某个单元(如 crond.service)是否启用
# systemctl is-enabled crond.service
5. 列出所有服务
# systemctl list-unit-files –type=service
6. Linux中如何启动、重启、停止、重载服务以及检查服务(如 httpd.service)状态
# systemctl start httpd.service
# systemctl restart httpd.service
# systemctl stop httpd.service
# systemctl reload httpd.service
# systemctl status httpd.service
注意:当我们使用systemctl的start,restart,stop和reload命令时,终端不会输出任何内容,只有status命令可以打印输出。
7. 如何激活服务并在开机时启用或禁用服务(即系统启动时自动启动mysql.service服务)
# systemctl is-active mysql.service
# systemctl enable mysql.service
# systemctl disable mysql.service
8. 如何屏蔽(让它不能启动)或显示服务(如ntpdate.service)
# systemctl mask ntpdate.service
ln -s ‘/dev/null”/etc/systemd/system/ntpdate.service'
# systemctl unmask ntpdate.service
rm ‘/etc/systemd/system/ntpdate.service'
9. 使用systemctl命令杀死服务
# systemctl kill crond
10. 列出所有系统挂载点
# systemctl list-unit-files –type=mount
11. 挂载、卸载、重新挂载、重载系统挂载点并检查系统中挂载点状态
# systemctl start tmp.mount
# systemctl stop tmp.mount
# systemctl restart tmp.mount
# systemctl reload tmp.mount
# systemctl status tmp.mount
12. 在启动时激活、启用或禁用挂载点(系统启动时自动挂载)
# systemctl is-active tmp.mount
# systemctl enable tmp.mount
# systemctl disable tmp.mount
13. 在Linux中屏蔽(让它不能启用)或可见挂载点
# systemctl mask tmp.mount
ln -s ‘/dev/null”/etc/systemd/system/tmp.mount'
# systemctl unmask tmp.mount
rm ‘/etc/systemd/system/tmp.mount'
14. 列出所有可用系统套接口
# systemctl list-unit-files –type=socket
15. 检查某个服务的所有配置细节
# systemctl show mysql
16. 获取某个服务(httpd)的依赖性列表
# systemctl list-dependencies httpd.service
17. 启动救援模式
# systemctl rescue
18. 进入紧急模式
# systemctl emergency
19. 列出当前使用的运行等级
# systemctl get-default
20. 启动运行等级5,即图形模式
# systemctl isolate runlevel5.target
或
# systemctl isolate graphical.target
21. 启动运行等级3,即多用户模式(命令行)
# systemctl isolate runlevel3.target
或
# systemctl isolate multiuser.target
22. 设置多用户模式或图形模式为默认运行等级
# systemctl set-default runlevel3.target
# systemctl set-default runlevel5.target
23. 重启、停止、挂起、休眠系统或使系统进入混合睡眠
# systemctl reboot
# systemctl halt
# systemctl suspend
# systemctl hibernate
# systemctl hybrid-sleep
对于不知运行等级为何物的人,说明如下。
Runlevel 0 : 关闭系统
Runlevel 1 : 救援,维护模式
Runlevel 3 : 多用户,无图形系统
Runlevel 4 : 多用户,无图形系统
Runlevel 5 : 多用户,图形化系统
Runlevel 6 : 关闭并重启机器
以上就是Linux中systemctl命令详细介绍的详细内容
Linux中systemctl命令详细介绍的更多相关文章
- linux下top命令详细介绍
linux下top命令详细介绍 top 命令是 Linux 下常用的系统资源占用查看及性能分析工具,能够实时显示系统中各个进程的资源(比如cpu.内存的使用)占用状况,top命令的执行结果是一个动态显 ...
- Linux培训教程 linux中nl命令使用介绍
nl命令在linux系统中用来计算文件中行号.nl 可以将输出的文件内容自动的加上行号!其默认的结果与 cat -n 有点不太一样, nl 可以将行号做比较多的显示设计,包括位数与是否自动补齐 0 等 ...
- Linux下VI命令详细介绍
vi 是"Visual Interface" 的简称,它在Linux 上的地位就仿佛Edit 程序在DOS上一样.它可以执行输出.删除.查找.替换.块操作等众多文本操作,而且 ...
- linux中ip命令使用介绍
ifconfig是CentOS 5.6系统中经典的配置网络的命令,但是到了CentOS 7的时候,命令就变成了ip了,我们也要学习,我们也要与时俱进.跟随高手一起学习 查看链路 ip link sho ...
- [转帖]linux中systemctl详细理解及常用命令
linux中systemctl详细理解及常用命令 2019年06月28日 16:16:52 思维的深度 阅读数 30 https://blog.csdn.net/skh2015java/article ...
- linux中systemctl详细理解及常用命令
linux中systemctl详细理解及常用命令 https://blog.csdn.net/skh2015java/article/details/94012643 一.systemctl理解 Li ...
- linux配置网卡IP地址命令详细介绍及一些常用网络配置命令
linux配置网卡IP地址命令详细介绍及一些常用网络配置命令2010-- 个评论 收藏 我要投稿 Linux命令行下配置IP地址不像图形界面下那么方 便,完全需要我们手动配置,下面就给大家介绍几种配置 ...
- Linux中监控命令top命令使用方法详解
收集了两篇关于介绍Linux中监控命令top命令的详细使用方法的文章.总的来说,top命令主要用来查看Linux系统的各个进程和系统资源占用情况,在监控Linux系统性能方面top显得非常有用,下面就 ...
- linux中top命令的用法
收集了两篇关于介绍Linux中监控命令top命令的详细使用方法的文章.总的来说,top命令主要用来查看Linux系统的各个进程和系统资源占用情况,在监控Linux系统性能方面top显得非常有用,下面就 ...
随机推荐
- redis集群尝试
1. 使用Docker搭建redis主从复制集群 安装参照 Docker 搭建redis 集群 启动服务 docker run --name redis-master -p 6379:6379 -d ...
- Docker的安装和启动
2.Docker安装与启动 2.1安装环境说明 Docker官方建议在Ubuntu中安装,因为Docker是基于Ubuntu发布的,而且一般Docker出现的问题Ubuntu是最先更新或者打补丁的.在 ...
- 11.纯 CSS 创作一个荧光脉冲 loader 特效
原文地址:https://segmentfault.com/a/1190000014700727 HTML代码: <html> <head> <link rel=&quo ...
- 《算法》第五章部分程序 part 6
▶ 书中第五章部分程序,包括在加上自己补充的代码,非确定性有穷自动机(NFA),grep 命令(利用 NFA 匹配) ● 非确定性有穷自动机(NFA) package package01; impor ...
- 使用windows性能计数器监控cpu使用率
https://blog.csdn.net/yabingshi_tech/article/details/26672355 2. http://blog.51cto.com/qixue/1702557 ...
- 作为sort()方法的参数的比较函数(高程三第五章)
<script> var nums = [0,1,5,10,15]; var nums2 = nums; nums.sort(); console.log(nums);//0,1,10,1 ...
- 图像识别___YUV学习手记
视觉专家很早以前就知道,人眼对亮度分辨率的敏感度高于对色彩分辨率的敏感度. 这就是早期模拟和数字压缩形式的主要动因.视频信号会分解为亮度和色度,这两个是组成色彩的元素,这类似于图像可以分解为红.绿.蓝 ...
- TFDStoredProc执行sql server的部分存储过程报错,有的是好的。
TFDStoredProc执行sql server的部分存储过程报错,有的是好的. Invalid character value for cast specification 暂时无解.用fdque ...
- Mysql索引,有哪几种索引,什么时候该(不该)建索引;SQL怎么进行优化以及SQL关键字的执行顺序
索引(Index)是帮助MySQL高效获取数据的数据结构.提取句子主干,就可以得到索引的本质:索引是数据结构. 1.按照索引列值的唯一性,索引可分为唯一索引和非唯一索引 非唯一索引:B树索引 crea ...
- centos7 Apache 2.4.6 多域名多网站配置
Apache 2.4.6 多域名多网站配置 在/etc/httpd/conf 下 编辑 vim httpd.conf 添加:ServerName 外网IP 并注释 #DocumentRoot &quo ...