linux端口及进程操作
目录:
1.防火墙设置
2.查看端口
3.通信抓包
4.查询进程及停止进程
1.防火墙设置
查看iptables状态(未关闭会造成一些端口无法使用)
service iptables status #防火墙状态 service iptables stop iptables #关闭防火墙 service iptables start iptables #开启防火墙 service iptables restart iptables #重启
2.查看端口
1、查看端口占用进程
lsof -i :端口号
2、查看端口是否被使用
netatat -n netstat -an|grep 8200
3、运行的端口
netstat -an |grep LISTEN
3.通信抓包
1、检测指定端口抓包
tcpdump -i eth0 port 9080
检测两台机子指定端口是否开放可采用:
一台使用telnet,另一台使用tcpdump监测数据。无反应则说明不同
4.查询进程及停止进程
1、查询进程
ps -ef|grep websphere #查询进程中匹配“websphere”字段的进程
2、杀掉进程
kill -9 进程id #强制杀掉进程