줄기세포

[Linux] netstat 명령어 사용중인 리스너 Port 검색 (CentOS) 본문

Linux

[Linux] netstat 명령어 사용중인 리스너 Port 검색 (CentOS)

줄기세포(Stem_Cell) 2021. 5. 27. 16:49

 

netstat명령어를 통해서 listener port 를 보려면

-n -a -p 옵션을 줍니다.

netstat -nap

n : port번호를 숫자로 보여줌

a : 모든 socket을 보여줌 connected 상태 아닌 소켓도 포함

p : 프로그램명과 PID를 보여줍니다

 

 

특정 프로세서만 보려면 grep으로 확인 가능

[tibero@ncloud ~]$ netstat -nap | grep tblistener
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:8629            0.0.0.0:*               LISTEN      9703/tblistener     
tcp        0      0 0.0.0.0:8666            0.0.0.0:*               LISTEN      9703/tblistener     
unix  2      [ ACC ]     STREAM     LISTENING     36460    9703/tblistener      /db/tibero6/instance/tibero/path/lsnrd_un
unix  3      [ ]         STREAM     CONNECTED     36492    9703/tblistener      
unix  3      [ ]         STREAM     CONNECTED     36489    9703/tblistener      
unix  3      [ ]         STREAM     CONNECTED     36488    9703/tblistener      
unix  3      [ ]         STREAM     CONNECTED     36497    9703/tblistener      
unix  3      [ ]         STREAM     CONNECTED     36490    9703/tblistener      
unix  3      [ ]         STREAM     CONNECTED     36461    9703/tblistener      
unix  3      [ ]         STREAM     CONNECTED     36491    9703/tblistener      
unix  3      [ ]         STREAM     CONNECTED     36495    9703/tblistener      
unix  3      [ ]         STREAM     CONNECTED     36496    9703/tblistener      
unix  3      [ ]         STREAM     CONNECTED     36487    9703/tblistener      
unix  3      [ ]         STREAM     CONNECTED     36494    9703/tblistener      
unix  3      [ ]         STREAM     CONNECTED     36493    9703/tblistener   

PID 9703 의 tblistener라는 Processor가 8629와 8666 Port를 점유하고 있네요.

 

 

netstat의 옵션은 아래에서 확인 가능합니다.

[tibero@ncloud ~]$ netstat --help
usage: netstat [-vWeenNcCF] [<Af>] -r         netstat {-V|--version|-h|--help}
       netstat [-vWnNcaeol] [<Socket> ...]
       netstat { [-vWeenNac] -I[<Iface>] | [-veenNac] -i | [-cnNe] -M | -s [-6tuw] } [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
        -W, --wide               don't truncate IP addresses
        -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
        -o, --timers             display timers
        -c, --continuous         continuous listing

        -l, --listening          display listening server sockets
        -a, --all                display all sockets (default: connected)
        -F, --fib                display Forwarding Information Base (default)
        -C, --cache              display routing cache instead of FIB
        -Z, --context            display SELinux security context for sockets

  <Socket>={-t|--tcp} {-u|--udp} {-U|--udplite} {-S|--sctp} {-w|--raw}
           {-x|--unix} --ax25 --ipx --netrom
  <AF>=Use '-6|-4' or '-A <af>' or '--<af>'; default: inet
  List of possible address families (which support routing):
    inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25) 
    netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP) 
    x25 (CCITT X.25) 

 

이상입니다.

Comments