In Linux, you can view the port, Process status, and kill process.
View Port:
Ps-aux | grep tomcat
Tomcat process with no port 8080 is found.
Run netstat-apn
View all processes and port usage. The following process list is found. The last column is PID/Program name.
Port 8080 is occupied by Java processes with a PID of 9658.
Run the following command: ps-aux | grep java, or run the command: ps-aux | grep pid.
You can clearly know which program occupies port 8080! Then determine whether to use the KILL command to KILL it!
Method 2: directly use netstat-anp | grep portno
That is, netstat-apn | grep 8080
View process:
1. The ps command is used to view the currently running process.
Grep is search
Example: ps-ef | grep java
Displays information about java CMD processes in all processes.
2. ps-aux | grep java
-Aux: Show All statuses
Ps
3. The kill command is used to terminate the process.
Example: kill-9 [PID]
-9 indicates that the process is forced to stop immediately.
You can use ps to view the process PID and kill to terminate the process.