usage: netstat [-veenNcCF] [<Af>] -r netstat {-V|--version|-h|--help}
netstat [-vnNcaeol] [<Socket> ...]
netstat { [-veenNac] -I[<Iface>] | [-veenNac] -i | [-cnNe] -M | -s } [delay]
-r, --route display routing table
-I, --interfaces=[<Iface>] display interface table for <Iface>
-i, --interfaces display interface table
-g, --groups display multicast group memberships
-s, --statistics display networking statistics (like SNMP)
-M, --masquerade display masqueraded connections
-v, --verbose be verbose
-n, --numeric don't resolve names
--numeric-hosts don't resolve host names
--numeric-ports don't resolve port names
--numeric-users don't resolve user names
-N, --symbolic resolve hardware names
-e, --extend display other/more information
-p, --programs display PID/Program name for sockets
-c, --continuous continuous listing
-l, --listening display listening server sockets
-a, --all, --listening display all sockets (default: connected)
-o, --timers display timers
-F, --fib display Forwarding Information Base (default)
-C, --cache display routing cache instead of FIB
-T, --notrim stop trimming long addresses
-Z, --context display SELinux security context for sockets
netstat [-vnNcaeol] [<Socket> ...]
netstat { [-veenNac] -I[<Iface>] | [-veenNac] -i | [-cnNe] -M | -s } [delay]
-r, --route display routing table
-I, --interfaces=[<Iface>] display interface table for <Iface>
-i, --interfaces display interface table
-g, --groups display multicast group memberships
-s, --statistics display networking statistics (like SNMP)
-M, --masquerade display masqueraded connections
-v, --verbose be verbose
-n, --numeric don't resolve names
--numeric-hosts don't resolve host names
--numeric-ports don't resolve port names
--numeric-users don't resolve user names
-N, --symbolic resolve hardware names
-e, --extend display other/more information
-p, --programs display PID/Program name for sockets
-c, --continuous continuous listing
-l, --listening display listening server sockets
-a, --all, --listening display all sockets (default: connected)
-o, --timers display timers
-F, --fib display Forwarding Information Base (default)
-C, --cache display routing cache instead of FIB
-T, --notrim stop trimming long addresses
-Z, --context display SELinux security context for sockets
예제(라우팅 정보 출력)
[root /]# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.62.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
211.174.62.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
0.0.0.0 211.174.62.1 0.0.0.0 UG 0 0 0 eth0
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.62.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
211.174.62.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
0.0.0.0 211.174.62.1 0.0.0.0 UG 0 0 0 eth0
예제( Listen 정보 출력)
[root /]# netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:49444 0.0.0.0:* LISTEN 2297/rpc.statd
tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN 2604/xinetd
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2928/mysqld
tcp 0 0 0.0.0.0:29998 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 2272/portmap
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 2570/cupsd
tcp 0 0 :::80 :::* LISTEN 5999/httpd
tcp 0 0 :::22 :::* LISTEN 2588/sshd
tcp 0 0 :::443 :::* LISTEN 5999/httpd
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:49444 0.0.0.0:* LISTEN 2297/rpc.statd
tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN 2604/xinetd
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2928/mysqld
tcp 0 0 0.0.0.0:29998 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 2272/portmap
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 2570/cupsd
tcp 0 0 :::80 :::* LISTEN 5999/httpd
tcp 0 0 :::22 :::* LISTEN 2588/sshd
tcp 0 0 :::443 :::* LISTEN 5999/httpd
"프로그래밍 / Linux & Shell Script" 분류의 다른 글
[shell script] bash read command (0) | 2014/02/11 |
[linux] shell command 로그 남기기 (0) | 2014/01/27 |
[linux] Linux Console에서 BEEP 사운드 끄기 (0) | 2014/01/27 |
[shell script] 배열(Array) 사용하기 (0) | 2014/01/10 |
[shell script] 함수(Function) 사용하기 (0) | 2014/01/09 |
[linux] 메모리 (0) | 2013/12/17 |
[shell script] Here Documents (0) | 2013/11/26 |
[shell script] directory exists check (0) | 2013/11/20 |
[shell script] 실행 경로 구하기 (0) | 2013/10/24 |
[shell] yum 장애 조치 (0) | 2009/04/21 |