How to check a port? locally and remotely on Linux

Bash Liste Des Attaques Ovh

About

This page is about Port management on Linux.

When you install a software (process), you need often to verify the available port in order to configure the component installation.

How to find which process uses a port?

with netstat, you can check port.

For example, below, you can see that the port 1521 is used to the program tnslsnr (The -p parameters means program and is mandatory)

netstat -tulpn | grep 1521
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)

Protocol   Recv-Q Send-Q  Local Address     Foreign Address     State
tcp        0      0       :::1521           :::*                LISTEN      4264/tnslsnr

where:

  • The protocol (tcp, udp, raw) used by the socket.
  • Recv-Q: The count of bytes not copied by the user program connected to this socket.
  • Send-Q The count of bytes not acknowledged by the remote host.
  • Local Address: Address and port number of the local end of the socket. Unless the –numeric (-n) option is specified, the socket address is resolved to its canonical host name (FQDN), and the port number is translated into the corresponding service name.
  • Foreign Address: Address and port number of the remote end of the socket. Analogous to “Local Address.”
  • State: The state of the socket (ESTABLISHED, LISTEN, …)
  • PID/Program name: Slash-separated pair of the process id (PID) and process name of the process that owns the socket.

How to check a port remotely?

with Network - netcat (nc, ncat)

  • Check one port
nc -zv hostname port
DNS fwd/rev mismatch: hostname  != hostname.lan
hostname  [192.168.135.6] 9000 (?) open

How to see the ports used by well-known services?

To see the port used by services, you can inspect the services file (The services translation file), located at:

/etc/services





Discover More
Card Puncher Data Processing
Linux / Unix

Linux is an open source software and anyone can take it and create this own Linux (of distribution). It's why you can find a lot of distribution on the market : Red Hat Oracle Enterprise Linux (which...
Map Of Internet 1973
Network - (netstat|network statistics) command-line tool

Netstat (network statistics) is a command-line tool that displays network connections (both incoming and outgoing), routing tables, and a number of network interface statistics. netstat...
Odi Create Master Repository Wizard
ODI - Installation version 10.1.3.5.0

LD_LIBRARY_PATH= Master Repository: Data structure containing information on the topology of the company's IT resources, on security and on version management of projects and data models. This repository...
Ports
What is a Port in computing?

This article is about the network port, what it is, how we use it and more
Windows 95 Wallpaper Version
Windows - How to know which program takes a port ?

The management of the port with Windows. When you install software, you need often to verify the available port in order to configure the component installation. With powershell. For the port...



Share this page:
Follow us:
Task Runner