CentOS7 常用命令

查看所有运行:systemctl list-units

查看所有:systemctl list-units --all

查看所有启动的服务:systemctl list-units --type=service 对应以前的chkconfig --list

查看是否启用防火墙:systemctl is-enabled firewalld.service

查看是否防火墙:ystemctl is-active firewalld.service或者systemctl status firewalld.service

停止防火墙:systemctl stop firewalld.service

启动防火墙:systemctl start firewalld.service

重启防火墙:systemctl restart firewalld.service

重载防火墙:systemctl reload firewalld.service

服务开机自启:systemctl enable httpd

服务不开机自启:systemctl disable httpd

杀死服务:systemctl kill firewalld.service

获取某个服务(httpd)的依赖性列表:systemctl list-dependencies httpd.service

查看主机名: hostnamectl status --static

查看某个服务的名称:systemctl list-units |grep XXX

文件与目录操作

cd /home 进入 ‘/home’ 目录

cd …/… 返回上两级目录

cd - 返回上次所在目录

cp file1 file2 将file1复制为file2

cp -a dir1 dir2 复制一个目录

cp -a /tmp/dir1 . 复制一个目录到当前工作目录(.代表当前目录)

ls 查看目录中的文件

ls -a 显示隐藏文件

ls -l 显示详细信息

ls -lrt 按时间显示文件(l表示详细列表,r表示反向排序,t表示按时间排序)

pwd 显示工作路径

mkdir dir1 创建 ‘dir1’ 目录

mkdir dir1 dir2 同时创建两个目录

mkdir -p /tmp/dir1/dir2 创建多个目录

mv dir1 dir2 移动/重命名一个目录

rm -f file1 删除 ‘file1’

rm -rf dir1 删除 ‘dir1’ 目录及其子目录内容

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值