查看所有运行: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’ 目录及其子目录内容