Windows netstat view ports, process occupancy

Source: Internet
Author: User

Goal: In a Windows environment, use the netstat command to see if a port number is occupied and for which process.

Operation: The operation is divided into two steps: (1) to see that the port is occupied by that PID; method one: Targeted viewing port, using command

Netstat–ano|findstr "< port number >", as shown in the last column of PID. The port number in the figure is 1068, and the corresponding PID is 3840.


Method Two: View all, and then find the corresponding port and PID.


The 5 columns in the first picture are the 5 columns corresponding to the above (a) figure.

(2) View the name of the process that corresponds to the PID.

Method One: Always use the command to find, tasklist|findstr "<pid number >"


As can be seen from the (c) diagram, the PID 3840 corresponds to the process name Msnmsgr.exe.

Method Two: View with Task Manager.

Pull up Task Manager and select columns, such as D.


View the process name that the PID corresponds to. As shown in (e) Msnmsgr.exe


Appendix: Enter Netstat/? At the command line. You can view information about netstat.

C:\Documents and Settings\administrator>netstat/?

Displays protocol statistics and current TCP/IP network connections.

NETSTAT [-A] [-b] [E] [-n] [-O] [-P proto] [-r] [-S] [-t] [-v] [interval]

-a displays all connections and listening ports.

-B displays included in the creation of each connection or listening port

Executable component. In some cases, the executable component is known

has multiple independent components, and in these cases

Sequence of components included in creating a connection or listening port

Be displayed. In this case, the executable component name

At the bottom of [], the top part is the component that it calls,

Wait until the TCP/IP section. Note this option

May take a long time, if you do not have sufficient permissions

May fail.

-e Displays Ethernet statistics. This option can be used with the-s

Options are used in combination.

-N Displays the address and port number in digital form.

-O Displays the owning process ID associated with each connection.

-P proto Displays the connection of the proto specified protocol; proto can be

One of the following protocols: TCP, UDP, TCPv6, or UDPV6.

If used with the-s option to display by protocol statistics, Proto can be one of the following protocols:

IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, or UDPV6.

-r Displays the routing table.

-S displays by protocol statistics. By default, displays IP,

Statistics for IPV6, ICMP, ICMPv6, TCP, TCPv6, UDP, and UDPv6;

The-p option specifies a subset of the default conditions.

-T displays the current connection uninstall status.

-V is used with the-B option to display the

To create a connection or a listening port for all executable components.

Component.

Interval the selected statistics again, each time between display

Pause interval (in seconds). Press CTRL + C to stop again

Displays statistical information. If omitted, Netstat displays the current

Configuration information (show only once)

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.