Assume that you now want to use port 18080 to run your new program, but you find that the port is already employed by other program. What need you do? First, find the target program using the specific port (18080, in this case), then shut the program down to free the specific port.
To find the target program using the port 18080:
And then you will get information looking like the below one:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME node 19802 orzzone llu IPv6 7394347 0t0 TCP *:18080(LISTEN)
See the PID (19802, in the above example)? It’s what you need in the next step.
Now kill the process:
kill -9 19802
All is done. Now the port 18080 is free for further use again.