[转载地址] http://blog.sciencenet.cn/blog-419883-662063.html
有时由于某种原因,某个端口被占用,如5432,这时如果想关闭这个端口怎么做呢?
1.首先用如下命令查看端口占用情况:[root@localhost local]# netstat -ano
2.然后查看占用5432端口的程序pid:
[root@localhost local]# lsof -i:5432
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
postgres 7035 postgres 3u IPv6 516068 0t0 TCP localhost:postgres (LISTEN)
postgres 7035 postgres 4u IPv4 516069 0t0 TCP localhost:postgres (LISTEN)
3.kill掉该进程
[root@localhost local]# kill -9 7035