Windows/linux View Port Occupancy command

Source: Internet
Author: User
Tags tomcat

1. Windows platform

Start → run →cmd into the command prompt, enter Netstat-ano to see all the connected PID in the task Manager to find the corresponding PID program if there is no PID in Task Manager, you can select "View"-"Choose Column" in Task Manager

The code is as follows Copy Code


C:>netstat-aon|findstr "80"

TCP 127.0.0.1:80 0.0.0.0:0 Listening 2016

Do you see that the port is occupied by a process number 2016 process, and continue with the following command:

The code is as follows Copy Code

C:>tasklist|findstr "2016"

Tor.exe 2016 Console 0 16,064 K

It's clear that Tor is taking up your port.


2, Linux

Today found the server on the Tomcat 8080 port does not come up, the old hint port has been occupied.

To use the command:

The code is as follows Copy Code

Ps-aux | grep Tomcat

Found no 8080-port Tomcat process.

Using commands: NETSTAT–APN

View all process and port usage. Found the following list of processes, where the last column is Pid/program name

The 8080 port was found to be occupied by the PID 9658 Java process.

Further use of the command: Ps-aux | grep Java, or directly: Ps-aux | grep PID View

You can know exactly which program the 8080 port is occupied by! Then decide whether to use KILL command to kill!

Method Two: Direct use

  code is as follows copy code
netstat   -anp   |   grep  PortNo
that is: NETSTAT–APN | grep 8080

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.