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常见的基础命令和配置的更多相关文章

  1. CentOS 7基础命令介绍

    01 CentOS基础命令介绍 重所周知,Linux是一个主要通过命令行来进行管理的操作系统,即通过键盘输入指令来管理系统的相关操作,包括但不限于编辑文件.启动/停止服务等.这和初学者曾经使用的Win ...

  2. CentOS常用基础命令大全

    这篇文章主要介绍了CentOS常用基础命令大全,学习centos的朋友需要掌握的知识,需要的朋友可以参考下 1.关机 (系统的关机.重启以及登出 ) 的命令shutdown -h now 关闭系统(1 ...

  3. centos和Ubuntu系统最小化安装基础命令

    CentOS系统常用的基础软件如下 yum install vim iotop bc gcc gcc-c++ glibc glibc-devel pcre \ pcre-devel openssl o ...

  4. Linux学习之CentOS(二)--初识linux的一些常用命令(基础命令)

    初次学习linux系统,首先也得会一些linux的基本命令.至少要先学会开启和关闭系统吧!我称为 基础命令! linux命令是对Linux系统进行管理的命令.对于Linux系统来说,无论是中央处理器. ...

  5. 【Linux】常见基础命令之系统操作

    linux现在基本上已成为面试的必考题目,特此总结一些常用的基础命令. cd:切换目录 lilip@ubuntu:~$ cd /home/lilip/test pwd:打印当前目录 lilip@ubu ...

  6. Centos 03 基础命令

    切换目录 cd ~ 切换到当前用户的家目录 cd - 切换到上一次的目录 上传与下载 支持包在Dial-up Networking Support选项里,没有装可以通过 1.yum install l ...

  7. CentOS基础命令

    为网卡配置静态IP地址建议通过交互式界面nmtui进行配置 firewalld和iptablesCentOS7使用firewald取代原来的iptables,但实际上底层还是iptables,在上层加 ...

  8. Linux最常用的基础命令

    Linux最常用的基础命令个人总结 计算机基础知识: 32bit和64bit系统的区别.系统运行机制 32bit=内存的最大寻址空间是2**32,也就是说最大只能使用4GB的内存64bit=内存的最大 ...

  9. 【03】循序渐进学 docker:基础命令

    写在前面的话 之前谈了啥是 docker 和怎么安装 docker,这里就谈谈 docker 命令的使用,当然,这里的使用可能只是局限于 docker 的增删查改. 另外需要注意的是,为了图片的美观, ...

随机推荐

  1. POJ3468(树状数组区间维护)

    A Simple Problem with Integers Time Limit: 5000MS   Memory Limit: 131072K Total Submissions: 89818   ...

  2. Python脚本开头两行:#!/usr/bin/python和# -*- coding: utf-8 -*-的作用

    转于:https://www.crifan.com/python_head_meaning_for_usr_bin_python_coding_utf-8/ 出处:在路上 一.基本功能 1)#!/us ...

  3. linux 时间处理 + 简单写log

    1s ==1000ms == 1,000,000us == 1,000,000,000 nanosecond uname -a Linux scott-Z170X 4.15.0-34-generic ...

  4. 编译内核是出现:arch/arm/mm/tlb-v4wbi.S:64:error: too many positional arguments

    内核:Linux-3.4.2 编译内核出现arch/arm/mm/tlb-v4wbi.S:64:error: too many positional arguments 交叉工具链太老了,换新一点的. ...

  5. windows7下安装gem包---bcrypt-ruby

    在Gemfile中添加 gem 'bcrypt-ruby', '~> 3.0.0' 然后执行bundle install,rails服务启动没有问题,但是运行程序时页面报错如下: cannot ...

  6. Unity添加自定义快捷键——UGUI快捷键

    在Editor下监听按键有以下几种方式: 自定义菜单栏功能: using UnityEngine; using UnityEditor; public static class MyMenuComma ...

  7. Flask01 初识flask、创建flask应用、flask启动配置

    1 什么是flask Flask是一个使用 Python 编写的轻量级 Web 应用框架.其 WSGI 工具箱采用 Werkzeug ,模板引擎则使用 Jinja2 . 百度百科:点击前往 中文文档: ...

  8. HDU 5862 Counting Intersections (离散化+扫描线+树状数组)

    题意:给你若干个平行于坐标轴的,长度大于0的线段,且任意两个线段没有公共点,不会重合覆盖.问有多少个交点. 析:题意很明确,可是并不好做,可以先把平行与x轴和y轴的分开,然后把平行y轴的按y坐标从小到 ...

  9. hdu1072

    #include <iostream> #include <cstdio> #include <cstring> #include <queue> us ...

  10. 打开Visual Studio Code,rg.exe占用CPU过高

    打开Visual Studio Code,再打开文件-首选项-设置 搜索“followSymlinks” 将“√”给取消掉