Q: How do I find what service is listening on a specific port? I how to find which program is listening on a specific port? a: in * NIX system, you can use any one of the commands below to get in on a specific TCP port to listen on the list.
Lsof: its function is to list open files, including the listening port. Netstat: this command will symbolically demonstrate a variety of network-related data and information content. Lsof command example you can enter the following command to view the IPv4 port: # lsof-Pnl + M-i4 you can enter the following command to view the IPv6 protocol for the port is listed under: # lsof-Pnl + M-i6 this example output: here we may wish to explain. The first column is the command, it gives information about the program name. Note the title details. For example, the second line of United States gweather * command from NWS Server (140.90.128.70) gets weather report information, including the interactive weather information network and other weather services. Here, we explain the command parameters. 1 .-P: this option constraint with the port number for network files to port name conversion. Constrained transformation can make lsof run faster. In the port name lookup does not work, this is very useful. 2 .-n: this option constraint with the port number for network files to host name translation. Constraint conversion can make running lsof faster. In the host name lookup fail, it is very useful. 3 .-l: this options govern user ID number to login. In the login name of the lookup is incorrect or is slow, this option is useful. 4. + M: this option allows the local TCP and UDP port mapper's registered address. 5 .-i4: only lists the port under the IPv4 protocol. 6 .-i6: only lists the IPv6 protocol for the port. Netstaty command for example enter the following command: # netstat-tulpn or # netstat-npl please see output:: ProtoRecv-QSend-QLocalAddressForeignAddressStatePID/Programnametcp000.0.0.0: 68810.0.0.0: * LISTEN6908/pytontcp00127.0.0.1: 6310.0.0.0: * LISTEN5562/cupsdtcp00127.0.0.1: 31280.0.0.0: * LISTEN6278/(squid) tcp00127.0.0.1: 250.0.0.0: * LISTEN5854/exim4udp000.0.0.0: 327690.0.0.0: * 6278/(squid) udp000.0.0.0: 31300.0.0.0: * 6278/(squid) udp000.0.0.0: 680.0.0.0: * 4583/dhclient3udp000.0.0.0: 68810.0.0.0: * 6908/pyton Please note that the last column gives the regarding the program name and port information. Here, we explain the meaning of the parameters:-t: displays the specified TCP port-u: specify display UDP ports-l: only display the listening sockets (so-called Sockets is to enable applications to read and write and send and receive communications protocol (protocol) and information program)-p: show the process identifier and the name of the program, each of the sockets/ports are part of a program. -N: no DNS polling (can speed up operations) on/etc/services file/etc/services is a plain ASCII file, it can provide Internet service, friendly text name, the default assignment of port numbers and protocol types. Each network program to tap into this file the service port number (and Protocol). You can benefit from the cat command or less command to view the file: $ cat/etc/services $ grep110/etc/services $ less/etc/services
No comments:
Post a Comment