LoginSignup
0
0

More than 1 year has passed since last update.

【Windows, Mac】address already in use :3000 対応 「プロセスを見つけて強制終了する」を1コマンドで

Last updated at Posted at 2023-02-06

はじめに

プロセスのIDを取得して、それをkillするのを1つにまとめている形です。
強制終了させるコマンドなので、用法用量にはご注意願います。

Windows(コマンドプロンプト)

for /f "tokens=5" %a in ('netstat -ano ^| findstr :3000') do taskkill /F /PID %a

ついでに powershell

foreach ($processId in (Get-NetTCPConnection -LocalPort 3000).OwningProcess) {
    taskkill /pid $processId /f
}

Mac (といっていいのか...)

lsof -i tcp:3000 | awk 'NR>1 {print $2}' | xargs kill
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0