Address: http://blog.chinaunix.net/u2/83758/showart_1832458.html
Problem description:
In the process of system management, it is often encountered that the port is occupied when a process is started. For example, port 9090 is often occupied when the WebSphere console is started. Use
Netstat-an |
Grep 9090 can see that the port is being listened on, but it does not know which process occupies the port. Of course, it can also change the port but it is troublesome. If you can find out which process occupies the port,
Kill the process.
Solution:
1. netstat-aan | grep <portnumber>
Find the corresponding port connection
PCB/ADDR
And connection protocol type.
Note: PCB ---- Protocol control block
2.
If yes
TCP
Connection, then
Rmsock <PCB/ADDR> tcpcb
If yes
UDP
Connection, then
Rmsock <PCB/ADDR> inpcb Next we will
Telnet
The
23
Port number is used as an example to describe this method:
# Netstat-aan | grep 23
F1000200019ce398 TCP 0 0 *. 23 *. * listen
We can see that
PCB/ADDR
Is
F1000200019ce398
And the protocol type is
TCP
. # Rmsock f1000200019ce398 tcpcb
The socket 0x19ce008 is being held by proccess 185006 (inetd ).
Command to report that the port is being
Inetd
Process usage,
PID
Is
185006
.
Note:
Rmsock
Command needs
Root
Permission execution.