Tip: This article is to record the code instructions commonly used in the learning process.
1. Centos system commands
1. Kernel version
1.1 Kernel version and operating system version
uname -a #uname -r
1.2 Check the running kernel version
cat /proc/version
2.Docker
2.1 Check the disk space occupied by docker
docker system df
2.2 Clean up all stopped containers
docker container prune
2.3 Clean the disk, delete closed containers, useless data volumes and networks, and dangling images (ie, untagged images)
docker system prune
2.4 Clean up volumes
docker volume ls // 查看当前卷列表
docker volume prune // 清理无用的卷 加-f为强制清理
3. Port open
3.1 Open ports
firewall-cmd --zone=public --add-port=80/tcp --permanent # 开放80端口
firewall-cmd --zone=public --remove-port=80/tcp --permanent #关闭80端口
firewall-cmd --reload # 配置立即生效
3.2 View all open ports on the firewall
firewall-cmd --zone=public --list-ports
3.3 Check which process the port is occupied by
netstat -lnpt | grep 80
3.4 View process details
ps 80
3.5 Terminate the process
kill -9 80
4. Firewall
4.1 Check firewall status
firewall-cmd --state
#或者
systemctl status firewalld
4.2 Turn off the firewall
systemctl stop firewalld
4.3 Turn on the firewall
systemctl start firewalld