服务命令(systemctl的使用)
常用的service与systemctl命令的对比

应用举例:
●start:开启服务 ●stop:停止服务 ●status:参数来查看服务运行情况 ●restart:重新加载服务 应用举例·;
#启动网络服务
systemctl start network #停止网络服务
systemctl stop network #查看网络服务状态
systemctl status network #查看防火墙
systemctl status firewalld
chkconfig命令与systemctl命令对比
设置开机启动/不启动

查看系统上所有的服务
查看系统服务应用举例:
systemctl [command] [-type=TYPE] [-all] 注意——type和——all符号 参数详解:
command -list-units:依据unit列出所有启动的unit。加上-all才会列出没启动的unit; - list-unit-files:依据/usr/lib//systemd/system/内的启动文件,列出启动文件列表 -type=TYPE 其中TYPE主要有service,socket,target
特殊用法:
systemctl # 列出所有的系统服务 systemctl list-units #列出所有启动unit systemctl list-unit-files #列出所有启动文件 systemctl list-unit-files | grep enable #过滤查看启动项
systemctl list-unit-files | grep sshd #过滤查看某服务的状态
systemctl命令用法 )systemctl is-active [unit type] #查看服务是否运行
2)systemctl mask [unit type] #注销指定服务 3)systemctl unmask [unit type] #取消注销指定服务
设置系统运行级别
运行级别对应表

设置运行级别
●get-default:取到当前的target ●set-default:设置指定的target为默认的运行级别 ●isolate:切换到指定的运行级别 ●unit.target:为上表中列出的运行级别

使用systemctl分析各服务之前的依赖关系

关闭网络服务
systemctl stop sshd #停止sshd(22端口) systemctl disable sshd #禁止开机启动
关闭防火墙
Centos7中关闭防火墙:
systemctl stop firewalld Centos7中允许开机自动启动: systemctl enable firewalld Centos7中禁止开机自动启动: systemctl disable firewalld Ubuntu中关闭防火墙:
systemctl stop ufw Ubuntu中允许开机自动启动: systemctl enable ufw Ubuntu中禁止开机自动启动: systemctl disable ufw
查看系统网络与监控(netstat)


查看已经监听的端口:
netstat -antp
服务命令(systemctl的使用)的更多相关文章
- Linux服务器,服务管理--systemctl命令详解,设置开机自启动
Linux服务器,服务管理--systemctl命令详解,设置开机自启动 syetemclt就是service和chkconfig这两个命令的整合,在CentOS 7就开始被使用了. 摘要: syst ...
- Centos7 服务 service 设置命令 systemctl 用法 (替代service 和 chkconfig)
在Centos 中 systemctl 是设置系统服务的命令,即 service , 它融合之前service和chkconfig的功能于一体. 可以使用它永久性或只在当前会话中启用/禁用服务 ...
- Centos7 环境下开机 自启动服务(service) 设置的改变 (命令systemctl 和 chkconfig用法区别比较)
参考文章: <Linux 设置程序开机自启动 (命令systemctl 和 chkconfig用法区别比较)> http://blog.csdn.net/kenhins/article/ ...
- Linux服务管理 systemctl命令详解
Linux服务器,服务管理--systemctl命令详解,设置开机自启动 syetemclt就是service和chkconfig这两个命令的整合 任务 旧指令 新指令 使某服务自动启动 ch ...
- Linux系统管理命令-systemctl 和 sshd 服务
一系统服务管理命令systemctl 开启一个服务 : systemctl start sshd 关闭一个服务: systemctl stop sshd 查看一个服务的状态: systemctl st ...
- systemd服务管理--systemctl常用命令
转自 :https://m635674608.iteye.com/blog/2359480 1. #systemctl enable crond.service //让某个服务开机启动(.servic ...
- CentOS 7.0关闭服务器的防火墙服务命令
1.直接关闭防火墙systemctl stop firewalld.service #停止firewallsystemctl disable firewalld.service #禁止firewall ...
- Linux 设置程序开机自启动 (命令systemctl 和 chkconfig用法区别比较)
之前在Linux centos 7 上安装了apache 和mysql,当时并没有设置开机自动启动. 最近又重新练习网页,每次开机总是要手动启动httpd和mysqld,不方便,就想设置成开机自动启动 ...
- systemct管理服务命令
systemctl管理服务的启动,重启,停止,重载,查看状态的命令 Systcinit命令(红帽RHEL6系统) Systemctl命令(红帽RHEL7系统) 作用 service foo star ...
随机推荐
- 标准C++常用头文件及描述
#include <algorithm> //STL 通用算法 #include <bitset> //STL 位集容器 #include <cctype> //字 ...
- PHP 文件夹上传
一.我的准备情况说明. 编辑器:sublime text3(用什么编辑器看自己爱好)服务器构建:使用phpstudy2014构建服务器,服务器文件存储在我自身电脑D盘的www文件中.(安装phpstu ...
- iOS去除数组中重复的model数据
// 去除数组中model重复 ; i < self.selectedModelArray.count; i++) { ;j < self.selectedModelArray.count ...
- Client Dimensions , offsetHeight , scrollTop 属性详解
http://stackoverflow.com/questions/22675126/what-is-offsetheight-clientheight-scrollheight http://ww ...
- jmeter设置全局变量与正则表达式提取器
接口测试中,很多接口都要带上登录后的token才能正常发送请求,这里记录一下登录获取token设置为全局变量供其他接口使用 登录后返回信息信息中会有一个token值,添加后置处理器中的正则表达式提取t ...
- 串的应用与kmp算法讲解--学习笔记
串的应用与kmp算法讲解 1. 写作目的 平时学习总结的学习笔记,方便自己理解加深印象.同时希望可以帮到正在学习这方面知识的同学,可以相互学习.新手上路请多关照,如果问题还请不吝赐教. 2. 串的逻辑 ...
- Lua for Mac环境搭建
1⃣️在Mac上安装Lua的运行环境再简单不过了,如果你的Mac Terminal上安装了Homebrew的话,只需要键入`brew install lua`即可. longsl-mac:~ long ...
- Android开发实例 Unity显示Toast
Android中的Toast是一种简易的消息提示框. 当视图显示给用户,在应用程序中显示为浮动.和Dialog不一样的是,它永远不会获得焦点,无法被点击.用户将可能是在中间键入别的东西.Toast类的 ...
- 【Linux开发】Linux模块机制浅析
Linux允许用户通过插入模块,实现干预内核的目的.一直以来,对linux的模块机制都不够清晰,因此本文对内核模块的加载机制进行简单地分析. 模块的Hello World! 我们通过创建一个简单的模块 ...
- 【Python】【基础知识】【内置函数】【dir的使用方法】
原英文帮助文档: dir([object]) Without arguments, return the list of names in the current local scope. With ...