(转)CentOS 7常见的基础命令和配置
2024-09-04 02:36:59
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 //查看级别的依赖性
最新文章
- C#使用读写锁三行代码简单解决多线程并发写入文件时线程同步的问题
- iOS后台播放
- Log功能
- AsyncTask的基本使用
- 一个简单的Java程序例子以及其几种注释
- 读写应用程序数据-SQLite3
- Scala - 处理时间(nscala-time - Joda Time的scala封装)
- python基础学习05(核心编程第二版)部分
- 什么是FastCGI?
- Hadoop--有关Hadoop的启动
- Android的状态栏通知(Notification)
- Python基础(十三)-进程&;线程
- 使用xUnit为.net core程序进行单元测试(3)
- IM群聊消息究竟是存1份(即扩散读)还是存多份(即扩散写)?
- Scala学习(九)练习
- 9.jexus 配置ssl
- Linux安装Tomcat-Nginx-FastDFS-Redis-Solr-集群——【第二集之新建虚拟机】
- Django 表关系
- LAMP平台部署
- Applegate 方法使用
热门文章
- Centos6.5命令行快捷键
- HDUj2612(两个起点找到最近的目的地)
- 【转】 Pro Android学习笔记(六一):Preferences(5):组织Preference
- 人物-IT-张志东:张志东
- 问题:HttpWebRequest request post 传参; 结果:好用的C# HttpWebRequest用Post同时提交参数和文件的封装类
- 大内存电脑在vbox安装linux报错
- [51nod1247]可能的路径(思维题)
- sklearn有关参数
- 掌握HDFS的Java API接口访问
- Unity3D 脚本模板修改方法