OpenBSD List Open TCP or UDP Network Ports

Tutorial details Difficulty Easy (rss) Root privileges No/Yes Requirements netstat/fstat Time N/A

ADVERTISEMENTS



Syntax: OpenBSD list open TCP or UDP network ports

How do I find out open TCP or UDP network ports under OpenBSD operating systems using the command line options?You need to use the netstat command. This command display network status in various network-related data structures. There are a number of output formats, depending on the options for the information presented. Another option is to use the nmap command from a remote computer, laptop or desktop system running *BSD, macOS, Unix or Linux operating systems. This page shows how to list open UDP or TCP network ports on a OpenBSD operating system.

The syntax is:

netstat [option] netstat -f inet -t

netstat -f inet -u

Let us see see some examples to display a list of open TCP/UDP network ports on OpenBSD.

Task: Display tcp and UDP open port

Type the following command:

$ netstat -nat

OR

$ netstat -na -f inet

OR

$ netstat -na -f inet | grep LISTEN

OR

$ netstat -atn | grep LISTEN



Just display IPv4 tcp ports, run:

$ netstat -f inet -at

Sample outputs:

Active Internet connections (including servers) Proto Recv-Q Send-Q Local Address Foreign Address (state) tcp 0 0 openbsd.23087 resolver1.opendn.domai TIME_WAIT tcp 0 0 openbsd.22 dsl-KK-dynamic-1.32789 ESTABLISHED tcp 0 448 openbsd.22 dsl-KK-dynamic-1.32786 ESTABLISHED tcp 0 0 *.22 *.* LISTEN tcp 0 0 localhost.submissi *.* LISTEN tcp 0 0 localhost.smtp *.* LISTEN tcp 0 0 *.time *.* LISTEN tcp 0 0 *.daytime *.* LISTEN tcp 0 0 *.auth *.* LISTEN Active Internet connections (including servers) Proto Recv-Q Send-Q Local Address Foreign Address (state) udp 0 0 localhost.biff *.* udp 0 0 *.syslog *.*

fstat command to display info about TCP or UDP and open files on OpenBSD

You can use fstat command to find out more about port 22 or 80 or 443 as follows:

fstat | grep ':80'

fstat | grep ':443'

fstat | grep ':22'

Sample outputs: