Check port usage in linux
1. Start a jetty server in the Fedora20 system. port 8080;
2. Run the following command:
[doctor@localhost bin]$ lsof -i:8080COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEjava 10033 doctor 180u IPv6 253547 0t0 TCP *:webcache (LISTEN)[doctor@localhost bin]$
Obtain PID 10033.
3. Run the following command:
[doctor@localhost ~]$ ps aux |grep 10033doctor 10033 1.7 12.4 6044780 979184 pts/1 Sl 11:07 0:34 /home/doctor/opt/jdk1.8.0_25/bin/java -Djetty.home=/home/doctor/opt/jetty9-jenkins -Djetty.base=/home/doctor/opt/jetty9-jenkins -Djava.io.tmpdir=/tmp -jar /home/doctor/opt/jetty9-jenkins/start.jar jetty-started.xmldoctor 10874 0.0 0.0 112696 2300 pts/1 S+ 11:41 0:00 grep --color=auto 10033[doctor@localhost ~]$
Or
[doctor@localhost ~]$ ps u 10033 |catUSER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMANDdoctor 10033 1.5 12.4 6044780 979184 pts/1 Sl 11:07 0:34 /home/doctor/opt/jdk1.8.0_25/bin/java -Djetty.home=/home/doctor/opt/jetty9-jenkins -Djetty.base=/home/doctor/opt/jetty9-jenkins -Djava.io.tmpdir=/tmp -jar /home/doctor/opt/jetty9-jenkins/start.jar jetty-started.xml[doctor@localhost ~]$
The cat display is mainly for line breaks, so that the information is fully displayed.