pwl 2017-07-10
1、查看占用8080端口的进程 [root@localhost apps]# netstat -apn | grep '8080' tcp 0 0 :::8080 :::* LISTEN 3394/java 如上面的3394位进程编号 2、查看该进程编号对应的程序 [root@localhost apps]# ps -aux | grep 3394 Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ root 3394 2.0 20.7 226388 51608 pts/1 Sl 06:38 1:02 java -jar springboot-integration.jar root 3748 0.0 0.2 4356 720 pts/1 S+ 07:30 0:00 grep 3394 3、杀死进程 kill -9 3394 4、根据进程号查看所属程序的位置 ls -al /proc/[进程号] [root@localhost bin]# ls -al /proc/2260 lrwxrwxrwx. 1 root root 0 Jul 4 06:48 cwd -> /opt/zookeeper-3.4.6/bin
----------------------------------------------------------------------------------------------------------------------
附加上windows的
C:\>netstat -aon | findstr "8081"
TCP 0.0.0.0:8081 0.0.0.0:0 LISTENING 6920
TCP [::]:8081 [::]:0 LISTENING 6920
tskill 6920