Why not login to Qiita and try out its useful features?

We'll deliver articles that match you.

You can read useful information later.

58
49

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

特定のポート番号を使用しているプロセスを見つけ、終了する方法

Last updated at Posted at 2020-05-03

ローカル開発時に、プロセスの占有により、アプリケーションが起動不可になることがよくあるので、対処方法の覚え書きを残しておきます。

環境

  • OS:WIndows10
  • 使用ツール:コマンドプロンプト

手順

1. 特定のポート番号を使用しているプロセスの確認

以下のコマンドを実行する

> netstat -ano | find "<ポート番号>"
コマンド(オプション) 用途
netstat ホストのネットワーク接続状態やソケット/インターフェイスごとのネットワーク統計の確認など
(-a) 現在のすべての接続を表示
(-n) 出力をIPアドレスなど数値のみに抑制
(-o) プロセスIDを表示
find テキストの検索

【例】ポート番号が8080の場合は、以下の通り

> netstat -ano | find "8080"

2. プロセスを終了させる

> taskkill /f /pid <プロセスID>
コマンド(オプション) 用途
taskkill タスクを終了させる
/f 強制終了
/pid プロセスIDの指定

【例】1の実行結果が

> netstat -ano | find "8080"
  TCP         0.0.0.0:8080           0.0.0.0:0              LISTENING       31712
  TCP         [::]:8080              [::]:0                 LISTENING       31712

だった場合は以下の通り

taskkill /f /pid 31712

参考

58
49
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
C_HERO

@C_HERO(ChiHaRu)

新人時代のプログラミング研修の成績がワースト2%の超アナログ系。 最近、サンプルコード系はzennに書いてます。 https://zenn.dev/c_hero

Linked from these articles

Comments

No comments

Let's comment your feelings that are more than good

Qiita Advent Calendar is held!

Qiita Advent Calendar is an article posting event where you post articles by filling a calendar 🎅

Some calendars come with gifts and some gifts are drawn from all calendars 👀

Please tie the article to your calendar and let's enjoy Christmas together!

58
49

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Login to continue?

Login or Sign up with social account

Login or Sign up with your email address