View that process takes up the port number (Linux vs. Aix)

Source: Internet
Author: User

In Linux:


Netstat command

[CPP]View Plaincopy
  1. [Email protected] ~]# Netstat-tulp
  2. Active Internet connections (only servers)
  3. Proto recv-q send-q Local address Foreign address State Pid/program Name
  4. Tcp        0      0 *:sunrpc                      *:*                           listen      2151/ rpcbind          
  5. TCP 0 0 *:50000 *:* LISTEN 3542/DB2SYSC 0
  6. TCP 0 0 192.168.122.1:domain *:* LISTEN 2881/DNSMASQ
  7. tcp        0      0  *:ftp                        *:*                           LISTEN       2640/vsftpd           
  8. tcp        0      0 *:ssh                         *:*                           LISTEN       2611/sshd             
  9. TCP 0 0 Localhost:ipp *:* LISTEN 2343/CUPSD
  10. TCP 0 0 localhost:smtp *:* LISTEN 2660/sendmail
  11. tcp        0      0  *:38666                      *:*                           LISTEN       2281/rpc.statd        
  12. tcp        0      0 *:35339                       *:*                           LISTEN       2281/rpc.statd        
  13. tcp        0      0  *:sunrpc                     *:*                           LISTEN       2151/rpcbind          
  14. tcp        0      0 *:ssh                         *:*                           LISTEN       2611/sshd             
  15. TCP 0 0 Localhost:ipp *:* LISTEN 2343/CUPSD
  16. TCP 0 0 *:wbem-https *:* LISTEN 2905/cimservermain
  17. udp        0      0  *:kerberos-iv               * :*                                        2087/portreserve      
  18. Udp        0      0 *:sunrpc                      *:*                                        2151/rpcbind          
  19. udp        0      0  *:rda                        *:*                                        2151/rpcbind           
  20. udp        0      0 *:ipp                         *:*                                        2343/cupsd             
  21. udp        0      0  *:rxe                        *:*                                        2281/rpc.statd         
  22. Udp        0      0 *:ldaps                       *:*                                        2087/portreserve      
  23. udp        0      0  *:d hcp-failover             *:*                                         2087/portreserve      
  24. udp        0      0 *:783                         *:*                                        2087/portreserve      
  25. udp        0      0  192.168.122.1:domain        *:*                                        2881/dnsmasq           
  26. Udp        0      0 *:bootps                      *:*                                        2881/dnsmasq          
  27. udp        0      0  *:bootpc                     *:*                                        2312/dhclient         
  28. udp        0      0 *: dhcp-failover2            *:*                                        2087/ portreserve      
  29. udp        0      0  *:33375                      *:*                                        2281/rpc.statd        
  30. Udp        0      0 *:sunrpc                      *:*                                        2151/rpcbind          
  31. udp        0      0  *:rda                        *:*                                        2151/rpcbind           
  32. UDP 0 0 *:34398 *:* 2281/rpc.statd


Fuser command

[CPP]View Plaincopy
    1. [Email protected] ~]# fuser-v 22/tcp
    2. User Process number Permission command
    3. 22/tcp:root 2611 F .... sshd
    4. Root 7441 F .... sshd


lsof command

[CPP]View Plaincopy
    1. [Email protected] ~]# lsof-i:22
    2. COMMAND PID USER FD TYPE DEVICE size/off NODE NAME
    3. sshd 2611 root 3u IPv4 16168 0t0 TCP *:ssh (LISTEN)
    4. sshd 2611 Root 4u IPv6 16172 0t0 TCP *:ssh (LISTEN)
    5. sshd 7441 root 3u IPv4 48583 0t0 TCP 192.168.1.105:ssh->192.168.1.100:61791 (established)


In Aix:


Netstat and Rmsock

[CPP]View Plaincopy
  1. (1) First use the Netstat command to view the port system kernel address (16 binary), such as the process of viewing SSH 22 port.
  2. # Netstat–aan |grep 22
  3. f1000600044c7398 TCP4 0 134.96.194.9.22 134.96.90.123.1797 established
  4. F1000600044e4b98 TCP4 0 0 *.22 * * LISTEN
  5. Including: f1000600044e4b98 TCP4 0 0 *.22 * * * LISTEN
  6. The behavior listens on port 22 port related information, f1000600044e4b98 is the system kernel address.
  7. (2) Call the Rmsock command to see the process number for that port:
  8. # Rmsock F1000600044e4b98 TCPCB (socket, TCPCB, INPCB, RIPCB or RAWCB)
  9. The socket 0x44e4808 is being held by Proccess 447250 (sshd). ---shows that the process number for Port 22 is 447250.


lsof command

[CPP]View Plaincopy
      1. # lsof-i:22
      2. COMMAND PID USER FD TYPE DEVICE size/off NODE NAME
      3. sshd 107084 root 3u IPv4 0xf100070000a3a3b0 0t0 TCP *:ssh (LISTEN)

View that process takes up the port number (Linux vs. Aix)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.