Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What processes are using which ports on unix?

Tags:

hp-ux

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.

like image 882
gnuchu Avatar asked Sep 24 '08 08:09

gnuchu


People also ask

How do I find out what processes are running on a specific port in Linux?

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.

How will you find a process using specific port in Unix and Windows?

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.


2 Answers

netstat -l (assuming it comes with that version of UNIX)

like image 91
Quentin Avatar answered Sep 26 '22 02:09

Quentin


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...

like image 44
lms Avatar answered Sep 25 '22 02:09

lms