centos7常用操作

查看主机ip  :ifconfig
查看主机名称:hostname
修改主机名称:vim /etc/hostname  然后重启(reboot)
添加主机ip和主机名称,做映射  vim /etc/hosts

防火墙:

CentOS 7.0默认使用的是firewall作为防火墙

查看防火墙状态

firewall-cmd --state

开启firewall

systemctl start firewalld.service

停止firewall

systemctl stop firewalld.service

重启firewall:

systemctl restart firewalld.service

禁止firewall开机启动

systemctl disable firewalld.service 

端口:

centos7中的防火墙改成了firewall,使用iptables无作用,开放端口的方法如下:

firewall-cmd --zone=public --add-port=8020/tcp --permanent

返回success为成功

命令含义: 

--zone #作用域 

--add-port=80/tcp #添加端口,格式为:端口/通讯协议 

--permanent #永久生效

查看监听(运行的,已经启动的)(Listen)的端口

netstat -lntp

检查端口被哪个进程占用

netstat -lnp|grep 8080

杀死进程

kill -9 PID

linux下jps命令
jps(Java Virtual Machine Process Status Tool)是JDK 1.5提供的一个显示当前所有java进程pid的命令,简单实用,非常适合在linux/unix平台上简单察看当前java进程的一些简单情况。

你可能感兴趣的:(linux)