DOS command to view port occupancy and shutdown processes

Source: Internet
Author: User

1. View Port occupancy

Execute under Windows command-line window:

TCP     127.0.0.1:80         0.0.0.0:0               LISTENING       2448

The port "8080" is occupied by a process with a PID (process number) of 2448.

To see if the port "8080" is occupied by which application, continue with the following command:

Tasklist|findstr "2448"
Notepad.exe                     Console                 0     16,064 K
2. Close process 2.1 Close process by process number
Taskkill/pid 2152

Multiple time formats are:

Taskkill/pid 2152/pid 1284
2.2 Closing processes by process name

To turn off Notepad.exe, the format is:

Taskkill/im notepad.exe

Specify multiple when the format is:

Taskkill/im Notepad.exe/im Iexplorer.exe

If you want to close all, use a wildcard character *, which is:

Taskkill/im *.exe
2.3 A prompt shutdown process
taskkill/t/im notepad.exetaskkill/t/pid 2152

This effect is prompted after the user is determined to close, there is a prompt box.

2.4 Forcibly terminating a process
taskkill/f/im notepad.exetaskkill/f/pid 2152
3. Port Status 3.1 listening status

The FTP service is first in the listening (LISTENING) state after it is started.

3.2 Established status

Established means to establish a connection. Indicates that two machines are communicating.

3.3 close_wait

When the other side actively shuts down the connection or the network exception causes the connection to be interrupted, our state becomes close_wait at this time we want to call Close () to make the connection close properly

3.4 time_wait

We actively call Close () to disconnect and receive confirmation from the other party that the status becomes time_wait. The TCP protocol states that the TIME_WAIT state will continue to be 2MSL (that is, twice times the maximum segment lifetime) to ensure that the old connection state does not affect the new connection. The resources in the TIME_WAIT state are not freed by the kernel, so as a server, try not to disconnect as aggressively as possible to reduce the resource waste caused by the time_wait state.

There is a way to avoid wasting time_wait resources, which is to close the socket linger option. However, this approach is deprecated by the TCP protocol, which may cause errors in some cases.

3.5 syn_sent Status

Syn_sent status indicates a request to connect, when you want to access the service of other computers to the first to send a synchronization signal to the port, the state is syn_sent, if the connection succeeds to become established, the Syn_sent state is very short. But if you find that syn_sent is very much and is being sent to different machines, your machine may be infected with a shock wave or a concussion. In order to infect other computers, this kind of virus will scan other computers, in the process of scanning for each computer to be scanned to make a synchronous request, which is also the cause of many syn_sent.

DOS command to view port occupancy and shutdown processes

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.