LoginSignup
12
12

More than 5 years have passed since last update.

使用しているポートのプロセスを調べる方法

Last updated at Posted at 2014-06-15

だれ?ポート使っているのは?

って思うときありますよね。そんなときは lsofコマンド。実は、Apache が起動しなくて何かしたっけ?と30分位はまったのでいつもの自分メモ。

あれ?怒られるw

Apache がなにをやっても起動しなく出ていたログ。誰か(プロセス)がすでにポートを使用しているという風に怒られ Apache が起動できません。

command
# /etc/init.d/httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
                                                           [FAILED]

おまえか!!

と、lsofコマンドを実行してみる。どうやら nginx が起動していたでござるった。
そりゃ Address already in use と怒られますね。

command
$ lsof -i | grep http
nginx     2945         root    7u  IPv4  15378      0t0  TCP *:http (LISTEN)
nginx     2946          git    7u  IPv4  15378      0t0  TCP *:http (LISTEN)
12
12
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
12
12