I need to find out what ports are attached to which processes on a Unix machine (HP Itanium). Unfortunately, lsof
is not installed and I have no way of installing it.
Does anyone know an alternative method? A fairly lengthy Googling session hasn't turned up anything.
Open a terminal. Type in the command: sudo netstat -ano -p tcp. You'll get an output similar to this one. Look-out for the TCP port in the Local Address list and note the corresponding PID number.
Use netstat Command to Find Process Listening on Port It has been around since the early 80's and is available not only on every Linux system, but also any UNIX or UNIX variant and Microsoft Windows since at least XP. The -a option means all, -n means show ports numerically not names, -p means show process id and name.
netstat -l (assuming it comes with that version of UNIX)
Given (almost) everything on unix is a file, and lsof lists open files...
Linux : netstat -putan or lsof | grep TCP
OSX : lsof | grep TCP
Other Unixen : lsof
way...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With