查看指定端口/服务所占用的端口
lsof
root@kylin-sdc153:/opt/govern/govern_1/domains/mydomain/logs# sudo lsof -i:6888
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 64812 root 100u IPv4 4135639 0t0 TCP *:6888 (LISTEN)
ss -lnp
root@kylin-sdc153:/opt/govern/govern_1/domains/mydomain/logs# ss -lnp | grep 6888
tcp LISTEN 0 512 *:6888 *:* users:(("java",pid=64812,fd=100))
ps
root@kylin-sdc153:/opt/govern/govern_1/domains/mydomain/logs# ps -ef
UID PID PPID C STIME TTY TIME CMD
...
root 70066 2 0 8月03 ? 00:00:00 [kworker/61:0]
root 70139 2 0 8月03 ? 00:00:00 [kworker/84:2]
root 70146 2 0 8月03 ? 00:00:00 [kworker/91:2]
...
root@kylin-sdc153:/opt/govern/govern_1/domains/mydomain/logs# ps -ef | grep 6888
root 66251 64699 0 10:05 pts/4 00:00:00 grep --color=auto 6888
root@kylin-sdc153:/opt/govern/govern_1/domains/mydomain/logs# ps -ef | grep apusic
root 64713 60453 0 09:59 pts/3 00:00:00 /bin/sh ./startapusic
root 64812 64713 77 09:59 pts/3 00:04:04 /usr/bin/java -Djava.endorsed.dirs=/opt/govern/govern_1/lib/endorsed -Dcom.apusic.domain.home=/opt/govern/govern_1/domains/mydomain -server -Djava.net.preferIPv4Stack=true -Djava.security.egd=file:/dev/./urandom -Xms1024m -Xmx2048m -XX:MaxPermSize=512m -javaagent:/opt/sefon-secure/secure-agent.jar -classpath .:/opt/govern/govern_1/classes:/opt/govern/govern_1/...
2.0.0.jar:/opt/govern/govern_1/lib/ext/*.zip/opt/govern/govern_1/domains/mydomain/lib/*.zip:/opt/govern/govern_1/domains/mydomain/lib/*.jar: com.apusic.server.Main -root /opt/govern/govern_1
...
杀掉指定进程ID的进程
kill
[杀掉指定PID的进程]
kill -9 <PID>
推荐文献
[Linux]常用命令之【ps/lsof/ss/kill/】