服务命令(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 ...
随机推荐
- git分支名大小写问题导致分支push到远程失败
windows系统不识别文件夹大小写导致 本地分支master, 在master上面新建一个分支Hotfix/aa 由于Hotfix首字母大写,所以windows系统会在 项目.git\refs\he ...
- java回调函数详解
声明:博客参考于https://www.cnblogs.com/yangmin86/p/7090882.html,谢谢哥们 回调函数:是指在A类执行代码时,调用了B类中的方法,但B类中的方法执行了A类 ...
- Fullgc引发redis超时异常
1.现象 -|2019-11-14 11:50:01.095|ERROR|TID:2254.3964.15737033664569521|DubboServerHandler-192.168.58.2 ...
- 五十五:WTForms表单验证之渲染模板
此功能看似强大,实则鸡肋 from wtforms import Form, StringField, BooleanField, SelectFieldfrom wtforms.validators ...
- java.lang.Double[] 转 double[]
Double[] v = list.stream().map(item -> item.getRespTime()).toArray(Double[]::new); Mean mean = ne ...
- makeObjectsPerformSelector的使用
NSArray 类定义的方法: makeObjectsPerformSelector:这是数组用的方法,类似于for循环. makeObjectsPerformSelector:@selector(m ...
- 重学Python - Day 06 - python基础 -> linux命令行学习 -- 简单基础命令学习
学习资源 虚拟机工具:VMWare 12 linux :Ubuntu 14 或者CentOS 6 PS:ubuntu用远程连接工具的设置方法 step 1: 输入sudo apt-get instal ...
- Linux C/C++基础——文件(上)
1.文件指针 FILE* fp=NULL; fp指针,只调用了fopen(),在堆区分配空间,把地址返回给fp fp指针不是指向文件,fp指针和文件关联,fp内部成员保存在文件的状态 操作fp指针,不 ...
- 关于session的一些问题
最近在做项目的时候碰见了session过期的问题,然后就上网查了一些资料,我将我整理过的知识点梳理一下,顺便说一下我的使用方案. Session存储在服务器端,一般为了防止在服务器的内存中(为了高速存 ...
- 【Linux开发】linux设备驱动归纳总结(十三):1.触摸屏与ADC时钟
linux设备驱动归纳总结(十三):1.触摸屏与ADC时钟 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ...