有时候需要在Linux下查看一个进程占用了那个端口,但是只知道进程大致的名称,比如要查看hadoop的namenode在哪个端口上运行,以便在eclipse中连接。
ps -ef | grep Name 查看到进程id之后,使用netstat命令查看其占用的端口: netstat -nltp | grep pid