What is the BSD equivalent of Linux `netstat -lptun`?

In Linux, netstat -lptun gives a list of servers with the following details:

  • protocol
  • local and foreign address
  • state
  • PID and program name

What is the command's equivalent in FreeBSD?

Thanks.

1

3 Answers

The command you want is sockstat. Use sockstat -4l to see just IPv4 listening sockets

1

On FreeBSD specifically, sockstat(1) is indeed useful.

You could also use fstat(1) on not just FreeBSD, but all modern BSD systems apart from OS X, although I guess fstat will only report presently open sockets each process may have, not the already closed ones recently. E.g., to omit non-internet files, try fstat | fgrep -e internet -e USER.

See also How to list open files on a UNIX system.

netBSD also have netstat program alongside their repository since netBSD 2.0, if on your machine doesn't have, you can install it, so you can use netstat on netBSD. here the guide

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like