1
0

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.

特定のポート番号を使用するプロセスを一括killするワンライナー

Posted at

ゾンビプロセスを駆逐するワンライナー。

特定のポートを使用しているプロセスを調べる。

$ lsof -i:ポート番号
COMMAND   PID USER   FD   TYPE    DEVICE SIZE/OFF NODE NAME
ruby    37922 xxxx    xx  IPv4 xxxxxxx      xxx  TCP xxxxx:xxxxxx (ESTABLISHED)

PIDだけ出力する。

$ lsof -ti:ポート番号
37922

一括kill

$ lsof -ti:ポート番号 | xargs kill -9

参考にしたサイト

1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?