How to identify the process listening on port

How to Identify the process listening on a port, on Linux, FreeBSD and OpenBSD.

OpenBSD:

fstat | grep ':25'

or

# netstat -Aan | grep "LISTEN"
0xdad16b28 tcp 0 0 \*.9102 \*.* LISTEN
0xf62f97f8 tcp 0 0 \*.3128 \*.* LISTEN
0xdad16e58 tcp 0 0 127.0.0.1.25 \*.\* LISTEN
0xdad16660 tcp 0 0 \*.37 \*.* LISTEN
0xdad16330 tcp 0 0 \*.13 \*.* LISTEN
0xdad16198 tcp 0 0 \*.22 \*.* LISTEN
0xdad167f8 tcp6 0 0 \*.37 \*.* LISTEN
0xdad164c8 tcp6 0 0 \*.13 \*.* LISTEN
0xdad16000 tcp6 0 0 \*.22 \*.* LISTEN

# fstat | grep 0xdad16e58
root master 6721 12* internet stream tcp 0xdad16e58 127.0.0.1:25

FreeBSD:

sockstat | grep ':25'

Linux:

lsof -i :25

or

netstat -n -p

will show process id

ps auxww | grep PID

will show command line