CentOS 7常见的基础命令和配置
2017-10-17 22:40
489 查看
管理服务
命令格式:
注意:以下name.service表示某个具体服务
服务查看
服务状态
杀掉进程
chkconfig命令的对应关系
用来列出该服务在哪些运行级别下启用和 禁用
查看服务是否开机自启:
查看服务的依赖关系:
运行级别
unit 配置文件:.target
查看依赖性:
命令格式:
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 //查看级别的依赖性
相关文章推荐
- Memcached 笔记与总结(1)Linux(CentOS 6.6) 和 Windows(7)下安装与配置 Memcached (1.4.24)与 Memcached 基础命令
- centos shell基础 alias 变量单引号 双引号 history 错误重定向 2>&1 jobs 环境变量 .bash_history source配置文件 nohup & 后台运行 cut,sort,wc ,uniq ,tee ,tr ,split, paste cat> 2.txt <<EOF 通配符 glob模式 发邮件命令mail 2015-4-8 第十二节课
- CentOS查服务器配置、关防火墙、改DNS、mysql配置问题集锦、CentOS编译PHP5.6常见错误
- struts2配置基础和常见错误
- centos常用命令、 文件目录、配置
- CentOS下hadoop完全分布式的基础配置
- Centos 7网络属性配置及命令
- centos7中让系统配置文件生效的命令
- centos6.5 安装 docker 及基础命令使用
- Centos的网络配置命令和文件
- CentOS6.2 命令配置网卡
- 关于Linu型的一些基础常见操作命令(二)
- CentOS7系统网络配置基础
- 思科常见基础命令(思科作业1)
- CentOS 常用命令和常用配置
- centOS 6.5命令方式配置静态IP
- NFS安装配置及常见问题、/etc/exports配置文件、showmount命令
- linux基础命令-centos
- linux入门基础_centos(一)--基础命令和概念