kill port 8080 windows cmd command
Show New code examples in category Other
On Windows, different processes are executed on different ports of TCP and UDP. Sometimes we need to access a certain port but cannot do so because another process is already using it. As a result, we must kill the process on that particular port. To stop particular processes, you can utilize the PID or port number. This article will elaborate on the method to kill processes currently using a port on localhost in Windows: Let’s get started! To kill the Windows process currently using the localhost port through Command Prompt, follow the below-listed steps. Step 1: Open Command Prompt First, press the “Window+R” key to open the Run box. Type “cmd” in the dropdown menu and hit the “OK” button to open a command prompt: Step 2: Check the localhost Port Running Process Utilize the “netstat” command to find out the currently running process on the localhost port: >netstat -ano | findstr :8000 Step 3: Kill Process Using PID Then, use the “taskkill” command and specify the PID of the process currently running on localhost and kill it: Step 4: Verify the Process State Again run the “netstat” command to verify that the port on the localhost is running any process or not: >netstat -ano | findstr :8000 As no output is shown, which indicates that the specified process is killed successfully: Step 5: Kill Process by Specifying localhost Port You can kill a process by specifying a localhost port using the “npx kill-port <port no>” command: We have successfully terminated the process that is running using a port on localhost: Let’s check out the method to kill the Windows process currently using a port on localhost through PowerShell. Method 2: Use PowerShell to Kill the Windows Process Currently Using a Port on localhostTo kill the Windows process currently using the localhost port with the help of Powershell, utilize the below provided steps. Step 1: Open Windows PowerShell Use the “Window+X” key, then choose “Windows PowerShell” as admin from the list of options that appears to open Windows PowerShell: Step 2: Find localhost Port Running any Process Firstly, find any process that is currently using a port on localhost by executing the provided command: > netstat -ano | findstr :8000 Step 3: Kill Process Using PID To terminate a process utilizing a localhost port, issue the “stop-process” command with the PID number: Step 4: Kill Process by Specifying localhost Port The localhost port number can also be used by the user to terminate the process. To do so, use the “Get-Process” command and pass its output to the “Stop-Process” command using the pipe operator “|”. This action will kill the process that is currently running on the specified port: > Get-Process -Id (Get-NetTCPConnection -LocalPort "8000").OwningProcess | Stop-Process Run the “netstat” command once again to confirm that the specified process has killed: > netstat -ano | findstr :8000 Now, let’s head towards the next section! To kill the process currently running on a port on localhost using the CurrPorts tool on Windows, follow the below-listed steps. Step 1: Download CurrPorts Visit the below-provided link and download the CurrPorts setup file: https://www.nirsoft.net/utils/cports.html#DownloadLinks Step 2: Extract CurrPorts Setup Folder Go to the “Downloads” directory and extract the zip folder. To do so, right-click on the file and choose the “Extract here” option: Step 3: Run CurrPorts Execution File Double click on the file to run the “cports.exe” file: Step 4: Kill Process Select the port, then choose the “Kill Processes Of Selected Port” option from the context menu to kill the processes: We have effectively demonstrated the methods to kill the process currently using a port on localhost in Windows. ConclusionTo kill the Windows process currently using a port on localhost, use the “npx kill-port 8000” command on Command Prompt. On Windows PowerShell, the “Get -process” command and the “Stop-process” command to find out and end the specified processes. Lastly, the CurrPorts tools can also be utilized for the same purpose. In this blog post, we have shown how to stop Windows processes that are currently using a port on localhost. About the authorI am graduated in computer science. I am a junior technical author here and passionate about Programming and learning new technologies. I have worked in JAVA, HTML 5, CSS3, Bootstrap, and PHP. |