101
104

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.

特定のポート番号をLISTENしているプロセスが知りたい

Last updated at Posted at 2013-06-27

とあるポート番号(ここでは11211)がLISTENされているかどうかはnetstatで確認できる。

$ netstat -ant4 | grep 11211
tcp        0      0 0.0.0.0:11211           0.0.0.0:*               LISTEN
$

ただ、これだとこのポート番号を使用しているプロセスが何なのかはわからない。プロセスも特定するにはlsofを使う。

# lsof -i4TCP:11211
COMMAND     PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
memcached 32583 root   27u  IPv4  71897      0t0  TCP *:11211 (LISTEN)
#

追記

netstatでも「-p」オプションを使えば可能(コメント参照)

101
104
3

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
101
104

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?