(转)CentOS 7常见的基础命令和配置
CentOS 7常见的基础命令和配置
原文:http://blog.51cto.com/hujiangtao/1973566
管理服务
命令格式:systemctl COMMAND name.service
注意:以下name.service表示某个具体服务
启动:service name start ==> systemctl start name.service
停止:service name stop ==> systemctl stop name.service
重启:service name restart ==> systemctl restart name.service
状态:service name status ==> systemctl status name.service
条件式重启:已启动才重启,否则不做操作: service name cond restart ==> systemctl try-restart name.service
重载或重启服务:先加载,再启动: systemctl reload-or-restart name.service
重载或条件式重启服务:systemctl reload-or-try-restart name.service
禁止自动和手动启动:systemctl mask name.service
取消禁止:systemctl unmask name.service
服务查看
##查看 某服务当前激活与否的状态: systemctl is-active name.service
##查看所有已经激活的服务: systemctl list-units --type|-t service
##查看所有服务: systemctl list-units --type service -a
服务状态
systemctl list-units --type service --all 显示状态
loaded:Unit 配置文件已处理
active(running): 一次或多次持续处理的运行
active(exited): 成功完成一次性的配置
active(waiting): 运行中,等待一个事件
inactive: 不运行
enabled: 开机启动
disabled: 开机不启动
static:开机不启动,但可被另一个启用的服务激活
杀掉进程
systemctl kill 进程名
chkconfig命令的对应关系
设定某服务开机自启:
chkconfig name on ==> systemctl enable name.service
设定某服务开机禁止启动:
chkconfig name off ==> systemctl disable name.service
查看所有服务的开机自启状态:
chkconfig --list ==> systemctl list-unit-files --type service
用来列出该服务在哪些运行级别下启用和 禁用
chkconfig sshd –list ==> ls /etc/systemd/system/*.wants/sshd.service
[root@localhost ~]# ls /etc/systemd/system/*.wants/sshd.service
/etc/systemd/system/multi-user.target.wants/sshd.service
查看服务是否开机自启:
systemctl is-enabled name.service
[root@localhost ~]# systemctl is-enabled sshd.service
enabled
查看服务的依赖关系:
systemctl list-dependencies name.service
运行级别
unit 配置文件:.target
ls /usr/lib/systemd/system/*.target
systemctl list-unit-files --type target --all //查看级别
查看依赖性:
systemctl list-dependencies graphical.target //查看级别的依赖性
(转)CentOS 7常见的基础命令和配置的更多相关文章
- CentOS 7基础命令介绍
01 CentOS基础命令介绍 重所周知,Linux是一个主要通过命令行来进行管理的操作系统,即通过键盘输入指令来管理系统的相关操作,包括但不限于编辑文件.启动/停止服务等.这和初学者曾经使用的Win ...
- CentOS常用基础命令大全
这篇文章主要介绍了CentOS常用基础命令大全,学习centos的朋友需要掌握的知识,需要的朋友可以参考下 1.关机 (系统的关机.重启以及登出 ) 的命令shutdown -h now 关闭系统(1 ...
- centos和Ubuntu系统最小化安装基础命令
CentOS系统常用的基础软件如下 yum install vim iotop bc gcc gcc-c++ glibc glibc-devel pcre \ pcre-devel openssl o ...
- Linux学习之CentOS(二)--初识linux的一些常用命令(基础命令)
初次学习linux系统,首先也得会一些linux的基本命令.至少要先学会开启和关闭系统吧!我称为 基础命令! linux命令是对Linux系统进行管理的命令.对于Linux系统来说,无论是中央处理器. ...
- 【Linux】常见基础命令之系统操作
linux现在基本上已成为面试的必考题目,特此总结一些常用的基础命令. cd:切换目录 lilip@ubuntu:~$ cd /home/lilip/test pwd:打印当前目录 lilip@ubu ...
- Centos 03 基础命令
切换目录 cd ~ 切换到当前用户的家目录 cd - 切换到上一次的目录 上传与下载 支持包在Dial-up Networking Support选项里,没有装可以通过 1.yum install l ...
- CentOS基础命令
为网卡配置静态IP地址建议通过交互式界面nmtui进行配置 firewalld和iptablesCentOS7使用firewald取代原来的iptables,但实际上底层还是iptables,在上层加 ...
- Linux最常用的基础命令
Linux最常用的基础命令个人总结 计算机基础知识: 32bit和64bit系统的区别.系统运行机制 32bit=内存的最大寻址空间是2**32,也就是说最大只能使用4GB的内存64bit=内存的最大 ...
- 【03】循序渐进学 docker:基础命令
写在前面的话 之前谈了啥是 docker 和怎么安装 docker,这里就谈谈 docker 命令的使用,当然,这里的使用可能只是局限于 docker 的增删查改. 另外需要注意的是,为了图片的美观, ...
随机推荐
- C++STL库中map容器常用应用
#include<iostream> #include<cstdio> #include<map> //按键值大小构成二叉搜索树 using namespace s ...
- Python:删除字符串中的字符
一.删除字符串两端的一种或多种字符 #strip().lstrip().rstrip()方法:(默认删除空格符) A.list.strip(字符):删除字符串两端的一种或多种字符: #例:删除字符串s ...
- mysql auto reset
参数说明: •相关参数说明: •dataSource: 要连接的 datasource (通常我们不会定义在 server.xml) defaultAutoCommit: 对于事务是否 autoCom ...
- GIT URI
https://u3shadow@code.google.com/p/myandorid/
- [hdu4734]F(x)数位dp
题意:求0~f(b)中,有几个小于等于 f(a)的. 解题关键:数位dp #include<bits/stdc++.h> using namespace std; typedef long ...
- [tyvj1860]后缀数组
题目链接:http://www.tyvj.cn/p/1860 解题关键:模板题.贴一个代码详解 http://www.cnblogs.com/staginner/archive/2012/02/02/ ...
- [多路dp]更难的矩阵取数问题
https://www.51nod.com/tutorial/course.html#!courseId=11&isCurrent=1 解题关键:1.注意i和j的最大取值都是n,k是i与j的和 ...
- DOM 中 Property 和 Attribute 的区别(转)
property 和 attribute非常容易混淆,两个单词的中文翻译也都非常相近(property:属性,attribute:特性),但实际上,二者是不同的东西,属于不同的范畴. property ...
- Unusual Sequences
题意: 求解合为 y 的总体 gcd 为 x 的正整数非空序列个数. 解法: 特判一下后,原问题等价于合为 s = y/x 的整体gcd为1的正整数序列个数. 1.$ans = \sum_{\sum{ ...
- 面试题: Spring 框架 Bean的生命周期
[Java面试五]Spring总结以及在面试中的一些问题. 1.谈谈你对spring IOC和DI的理解,它们有什么区别? IoC Inverse of Control 反转控制的概念,就是将原本 ...