netstat
ネットワークの各種情報を表示するコマンド。
オプション | 動作 |
---|---|
なし | ソケットの状態を表示する |
-i | インターフェースのトラフィック情報 |
-s | プロトコルごとのトラフィック情報 |
-a | プロトコルとソケットの情報 |
-an | ポート番号などを数値で表示 |
-r | ルーティングテーブルの表示 |
-l | 接続待ち状態のソケットのみ表示する |
-p | PIDやプログラム名を表示 |
接続が確立しているソケットの情報を表示
# netstat Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address State Active UNIX domain sockets (w/o servers) Proto RefCnt Flags Type State I-Node Path unix 6 [ ] DGRAM 1036 /dev/log unix 2 [ ] DGRAM 1475 unix 2 [ ] DGRAM 1397 unix 2 [ ] DGRAM 1143 unix 2 [ ] DGRAM 1060 unix 2 [ ] STREAM CONNECTED 555
すべてのソケットの情報を表示
# netstat -a Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 *:wnn6 *:* LISTEN tcp 0 0 *:sunrpc *:* LISTEN tcp 0 0 *:http *:* LISTEN tcp 0 0 *:ssh *:* LISTEN tcp 0 0 *:https *:* LISTEN udp 0 0 *:bootpc *:* udp 0 0 *:sunrpc *:* Active UNIX domain sockets (servers and established) Proto RefCnt Flags Type State I-Node Path unix 6 [ ] DGRAM 1036 /dev/log unix 2 [ ACC ] STREAM LISTENING 1450 /tmp/jd_sockV4 unix 2 [ ] DGRAM 1475 unix 2 [ ] DGRAM 1397 unix 2 [ ] DGRAM 1143 unix 2 [ ] DGRAM 1060 unix 2 [ ] STREAM CONNECTED 555
PIDやプログラム名を表示する
# netstat -ap Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 GodzillaAir.localdomai:2208 *:* LISTEN 3226/./hpiod tcp 0 0 *:sunrpc *:* LISTEN 2526/portmap tcp 0 0 *:http *:* LISTEN 5507/httpd tcp 0 0 *:ssh *:* LISTEN 3246/sshd tcp 0 0 GodzillaAir.localdomain:ipp *:* LISTEN 3257/cupsd tcp 0 0 GodzillaAir.localdomai:smtp *:* LISTEN 3306/sendmail tcp 0 0 *:servstat *:* LISTEN 2571/rpc.statd tcp 0 0 *:https *:* LISTEN 5507/httpd
[コマンド]