安装netstat插件 yum install net-tools
安装killall插件 yum install psmisc
查看ip:
ip addr 192.168.1.111
查看所有端口 netstat -ano ( netstat -tunlp)
开启端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
命令含义:
--zone #作用域
--add-port=80/tcp #添加端口,格式为:端口/通讯协议
--permanent #永久生效,没有此参数重启后失效
重启防火墙
firewall-cmd --reload
查看端口
firewall-cmd --zone=public --query-port=80/tcp --permanent
关闭firewall:
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
firewalld启动:# systemctl start firewalld
查看状态:# systemctl status firewalld或者firewall-cmd --state
禁用:# systemctl stop firewalld
查看全部服务命令:
systemctl list-unit-files --type service
查看服务
systemctl status name.service
启动服务
systemctl start name.service
停止服务
systemctl stop name.service
重启服务
systemctl restart name.service增加开机启动
systemctl enable name.service
删除开机启动
systemctl disable name.service
其中.service 可以省略。
配置开机启动
systemctl enable tomcat
启动tomcat
systemctl start tomcat
停止tomcat
systemctl stop tomcat
重启tomcat
systemctl restart tomcat
因为配置pid,在启动的时候会再
systemctl reboot 重启机器
systemctl poweroff 关机
systemctl suspend 待机
systemctl hibernate 休眠
centos7配置常用命令
最新推荐文章于 2024-03-06 22:50:05 发布