
其中:

systemctl start/stop/restart/status 服务名
操作的是/usr/lib/systemd/system目录下的服务
systemctl list-unit-files:查看服务开机启动状态systemctl disable service_name:关掉指定服务的自动启动systemctl enable service_name:开启指定服务的自动启动A—B,假设B是A的硬链接,那么他们两个指向了同一个文件!允许一个文件拥有多个路径,用户可以通过这种机制建立硬链接到一些重要文件上,防止误删!
软链接也称为符号链接,类似于 windows 里的快捷方式,有自己的数据块,主要存放了链接其他文件的路径
ln -s [原文件或目录] [软链接名] :给原文件创建一个软链接
gzip 文件gunzip 文件.gzzip [选项] 压缩后名称 压缩的内容unzip [选项] XXX.zip本身并不做压缩,只是打包归档;需要配合-z才能进行压缩,即先打包再压缩。
tar [选项] XXX.tar.gz 将要打包进去的内容systemctl restart crondcrontab [选项]crontab -e命令进入vim编辑器*/1 * * * * /bin/echo ”11” >> /root/bailongma.txtps含义:process status 进程状态
ps 选项 ps auxps -efkill [选项] 进程号killall 进程名称top [选项]
netstat -anp | grep 进程号netstat –nlp | grep 端口号firewall是centos7里面的新的防火墙命令,它底层还是使用 iptables 对内核命令动态通信包过滤的,简单理解就是firewall是centos7下管理iptables的新命令
# 查看防火墙状态
service iptables status
# 停止防火墙
service iptables stop
# 启动防火墙
service iptables start
# 重启防火墙
service iptables restart# 永久关闭防火墙
chkconfig iptables off
# 永久关闭后重启
chkconfig iptables on
# 1.编辑iptables文件vim /etc/sysconfig/iptables
# 2.加入如下代码
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
# 3.保存退出后重启防火墙
service iptables restart
# 1、查看firewall服务状态
systemctl status firewalld# 2、查看firewall的状态
firewall-cmd --state# 3、开启、重启、关闭、firewalld.service服务
# 开启
service firewalld start
# 重启
service firewalld restart
# 关闭
service firewalld stop# 4、查看防火墙规则
firewall-cmd --list-all# 5、查询、开放、关闭端口
# 查询端口是否开放
firewall-cmd --query-port=8080/tcp
# 开放80端口
firewall-cmd --permanent --add-port=80/tcp
# 移除端口
firewall-cmd --permanent --remove-port=8080/tcp# 6、重启防火墙(修改配置后要重启防火墙)
firewall-cmd --reload# 参数解释
1、firwall-cmd:是Linux提供的操作firewall的一个工具;
2、--permanent:表示设置为持久;
3、--add-port:标识添加的端口;