Linux view process port number, process ID

Source: Internet
Author: User
Tags first row port number

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.