This is the fifth day of my participation in the August Wen Challenge.More challenges in August

In the Windows operating system, it is often found that the port is occupied during the development process. It is a necessary skill to quickly find the occupied port and end the process. The following uses port 9999 as an example

A operation,

1. First find the process ID PID that occupies port 9999

CMD open the page (win+R enter CMD)

Execute the command netstat ano | findstr searches in 9999

The last column of this command output shows the process number occupying port 9999, which is 21148

2. Kill the process

CMD Execute command

taskkill /F /PID 21148
Copy the code

Done!

2.1 List all tasks and their process ids

tasklist /? Taskkill taskkill /? Get helpCopy the code

2.2 CD Switching directories

cd /? CD \ // Jump to the root directory of the hard disk CD C:\WINDOWS // Jump to other files on the current hard disk D: // Jump to other folders on other hard disks CD /d e:\software // Jump to other folders on other hard disks Note that the /d parameter must be added here. Otherwise, it cannot jump. cd.. // Jump to the previous directoryCopy the code

2.3 netstat Viewing the network connection status

Displays protocol statistics and current TCP/IP network connections. This command displays the status of all network links established on the current machine and the corresponding process. Netstat -help Obtain the help information about the command line netstat -ano // View the network connection, status, and process IDCopy the code

2.4 the find

The find /? Get use to help netstat ano | find. "8" / / using pipeline operator, fuzzy queryCopy the code

2.5 the ping

 ping -help 
Copy the code

2.6 tracert

Tracert is also known as the Windows route tracing utility. Using the tracert command at the command prompt (CMD) can be used to determine the path selected when an IP packet accesses the destination. tracert /? For help, see tracert www.baidu.comCopy the code

2.7 ipconfig # Check your IP address

2.8 “|” “| in the CMD command represents the output of the previous one after input

Find specific IP network connection and process: netstat ano | find "192.168.1.10."Copy the code

2.9 Redirecting Output Symbols >> >

Save the output from the command window to a file, such as jstack 12912 >d:/s.txt print thread to the specified file CMD > redirect the output and overwrite the source file. For example, echo hello >c:\1.txt The contents of the 1. TXT file are cleared and then written to Hello. CMD >> Add the redirection output to the end of the file. For example, run the echo hello >c:\1. TXT command to add Hello to the end of the 1. TXT fileCopy the code

2.10 Redirecting Input Symbols << <

CMD < file causes the CMD command to read from file into CMD << text to read input from the command line until a line identical to text ends. Unless the input is enclosed in quotes, this mode performs shell variable substitution on the input. If you use <<-, the TAB at the beginning of the next input line is ignored, and the closing line can be a bunch of tabs plus the same content as text, as shown in the following example. CMD <<< word supplies word (not the file word) and the following newline as input to CMD. CMD <> file redirects the file file to input in read/write mode. The file file will not be destroyed. It only makes sense if the application leverages this feature. CMD > | file function with >, but even when setting the noclobber will overwrite the file file, pay attention to using | instead of some book! , currently only used in CSH >! Implement this feature.Copy the code

2.11 Terminating the Command that has been running CTRL + C

Sometimes a command keeps printing results (for example, ping 192.168.1.10 -t) and we want to stop the command by pressing CTRL + C.Copy the code

2.12 Clearing the contents of the CMD Window Command CLS

Sometimes CMD content is too much, scrolling is too much, you need to clear the screen content, directly enter CLSCopy the code

2.13 In the CMD command, press the up arrow to copy the previous command