TISKBAF
  • 🖥️Linux OS
    • Useful Linux commands
    • To get a list of the dependencies of a package
    • Reset a Forgotten Root Password
    • How to Kill a Port in Linux
    • How to Install/Reinstall Linux GRUB Menu
    • Concatenate mp4 files using FFmpeg
    • Command to stop mirroring screens
    • Command to Run when Trash Won’t Empty
    • Prey Configuration Command (via Terminal)
    • Prey Configuration Command (via Terminal)
  • 🖥️Windows OS
    • Custom Profile Badges
      • badge-maker
      • shields.io - static badges
    • How to kill a task via terminal on Windows
    • Find and terminate a Windows Process by Port
    • The Complete List of Command Prompt (CMD) Commands
    • youtube-dl Usage
    • WSA/Google Play Services Reference Information
    • Windows Update Blocker (Windows Services Blocker)
    • Windows 11 Shell commands with friendly names
    • Wifi not automatically connecting on start-up when Ethernet is connected
    • To install many APK files at once
    • To get Firefox to remember logged in accounts
    • Spicetify Commands
    • Speech Recognition Commands
    • Simpletask [Simple] Documentation
    • Sideload Apps in Windows Subsystem for Android from APK Files
    • SetUserFTA Utility
    • Screensaver not starting even though it is configured correctly
    • Run Keys Registry Location
    • Rainmeter Config Definitions
    • Pushover
    • Program Folder Locations
    • Add an exclusion to Windows Security (or just turn off real-time protection)
    • Reddit RSS Feeds
    • Portainer on Windows
    • PGP: Encrypt & sign emails in a few clicks
    • Permanently Remove OneDrive from Windows
    • IRC NickServ Commands (full list)
    • Convert a P12/PFX Certificate to a .CER
    • How to embed in HTML
    • Misc. Windows Information
    • Issues with missing icons in Windows
    • Information on ‘scoop’ package manager for Windows
    • DISMTools Docs
    • Creating Python Virtual Environment in Windows and Linux
    • Using XnConvert to bulk convert image sizes
    • How to Merge Multiple Text Files using different methods in Windows
    • How to use OLLAMA_ORIGINS in Windows
    • To permanently turn off Windows Security and Windows Defender1
    • Enabling the disabled sounds in Windows
    • Enable classic right-click context menu on Windows 11
    • How to Convert Kindle Books (.awz/.awz3) to Other E-book Formats
    • How to Create Symbolic Links with mklink
    • APIMyLlama Commands
  • 🏬[Graphic] Design
    • Create a Realistic Shadow for Objects in GIMP (video)
    • How to Add Outer Glow Effects in GIMP
    • How to Curve Text In GIMP
    • Rounded corners in GIMP (video)
    • WORD CLOUD TEXT PORTRAIT EFFECT IN PHOTOSHOP (video)
    • BROKEN 3D TEXT EFFECT | PHOTOSHOP (video)
    • Type on a path in Photoshop
    • Nudify Guide (Stable Diffusion)
  • 💻Coding & Developing
    • APIMyLlama V2
      • APIMyLlama Source: Github
    • Insert Back button on a webpage
    • How to have a web page refresh automatically
    • AstroPaper Blog Theme
      • How to configure AstroPaper theme - Blog
      • Adding new posts in AstroPaper theme
    • How to generate Django SECRET_KEY
  • 📒Everything else
    • RSS Feed in your Notion Pages
    • 12 Firefox Hidden Settings You Should Check Out
    • ADB (almost) Full Commands List
    • How to pair your Wear OS smartwatch with a new phone
    • How to reset Cync by GE smart lights
    • IRC Servers & Channels Info
    • Internxt CLI commands and usage
    • Call Forwarding on mobile device
    • Obsidian Templater plugin
    • Exportify Documentation
    • KLLOQUE K10 B Ball Lock User Manual
    • How to delete bloatware from Android device
Powered by GitBook
On this page
  • Find the Process ID (PID)
  • Confirm that PID is for the program in question
  • Stop the running process
  • Summary
  1. Windows OS

Find and terminate a Windows Process by Port

Two common ports that may experience this error include 3000 and 8081, but can be any port.

Find the Process ID (PID)

For this, we can use netstat -a -o -n to list all active connections.

C:\Users\user> netstat -a -o -n

Active Connections

Proto  Local Address          Foreign Address        State           PID
...
TCP    [::]:8080              [::]:0                 LISTENING       3664
...

In the list that gets spat out, find the line that has a Local Address ending in the port you want to terminate - in this case we see:8080. Note the value in the PID column - we'll need that in a minute. NOTE: This value will most likely be different each time you start your program.

Confirm that PID is for the program in question

This step is optional, but I like to double check that I'm targeting the correct process before I terminate it.

To get a list of tasks running in cmd we can run tasklist which details everything actively running on your machine. See How to kill a task via terminal on Windows

C:\Users\user> tasklist

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
...
node.exe                      6736 Services                   0      2,080 K
cmd.exe                       3048 Services                   0      2,268 K
node.exe                      3664 Services                   0      6,768 K
...

Here, you can see that there are multiple node.exe programs running, but only one of them has the PID3664.

Stop the running process

Now that you know that it is3664 PID, you can commence putting an end to our runaway process. The general format is taskkill /f /pid ####, replacing the #### with the PID from above. If you try to run this without the /f flag, you'll most likely be prompted to use the /f Force flag by Windows.

C:\Users\user> taskkill /f /pid 3664
SUCCESS: The process with PID 3664 has been terminated.

And now you're set to start your process again!

Summary

  • Find what Process ID (PID) is occupying the port in question with netstat -a -o -n

  • (Optional) Confirm this PID is for the expected program with tasklist

  • Terminate the process with taskkill /f /pid #### (replace #### with your PID)

PreviousHow to kill a task via terminal on WindowsNextThe Complete List of Command Prompt (CMD) Commands

Last updated 7 months ago

🖥️