系统版本
- Linux:CentOS Linux release 7.6.1810 (Core)
系统常用命令
// 1、查看系统版本
[root@localhost ~]# cat /etc/redhat-release
// 2、查看内存情况
[root@localhost ~]# cat /proc/meminfo
// 3、显示CPU info的信息
[root@localhost ~]# cat /proc/cpuinfo
// 4、重启
[root@localhost ~]# reboot
// 4、重启
[root@localhost ~]# reboot
Yum软件包
// 1、列出所有可更新的软件清单命令
[root@localhost ~]# yum check-update
// 2、更新所有软件命令
[root@localhost ~]# yum update
FireWall防火墙
在6.x中用的是iptables,但在CentOS 7.x中,使有了一种新的防火墙策略:FireWall。
// 1、查询防火墙状态
// 方法一:输出running表示已经开启,反之没有
[root@localhost ~]# firewall-cmd --state
// 方法二:Active如果为active则表示开启,反之没有
[root@localhost ~]# systemctl status firewalld
// 2、启动防火墙
[root@localhost ~]# systemctl start firewalld
// 3、端口操作
// 查看所有开放的端口
[root@localhost ~]# firewall-cmd --list-ports
// 查看指定端口的状态
[root@localhost ~]# firewall-cmd --zone-public --query-port=81/tcp
// 添加新端口(需重启防火墙才生效)
[root@localhost ~]# firewall-cmd --zone=public --add-port=81/tcp --permanent
// 关闭端口(需重启防火墙才生效)
[root@localhost ~]# firewall-cmd --zone=public --remove-port=81/tcp --permanent
// 4、重启防火墙
[root@localhost ~]# firewall-cmd --reload
// 5、关闭防火墙
[root@localhost ~]# systemctl stop firewalld
网络
// 下载命令
[root@localhost ~]# wget url