1 netstat-nlp to view the service that uses the port number
2 process to find this port number
3 Find the Process ID
4 Kill it
How do I view the port number of a process?
NETSTAT-LNP | grep EXF
TCP 0 0 0.0.0.0:9101 0.0.0.0:* LISTEN 5791/exfilter
Note: The exfilter in the above command is the name. The top 9101 is the port number of the monitor, and 5791 is the process ID of the procedure.
How can I view the ID of a process if the process does not monitor a port like Exfilter?
PS aux | grep exfilter
Root 5791 0.0 2.2 59184 11256? Ss 02:11 0:00./exfilter/bin/exfilter-f default-d
Root 5823 0.0 0.1 61220 732 pts/1 r+ 02:23 0:00 grep exfilter
Note: The first row, 5791 of the second column, is the process ID. At the end of the first line, the commands and parameters at startup are listed.
The port number finds the ID of the corresponding process, and the action process
If the port number is known to be 15000, the corresponding lookup command is Lsof-i | grep 15000
The results of this machine display are:
Host 3386 Trinea 4u IPv4 16907 0t0 TCP *:15000 (LISTEN)
3386 of which is the process number, and then you can manipulate the process using the appropriate operation commands, such as Kill
Kill-9 3386