lsof list open files

1
2
3
4
lsof -i -P -n | grep LISTEN
- -i selects the listing of all Internet and x.25 (HP-UX) network files
- -P inhibit the conversion of port numbers to port names
- -n inhibit the conversion of network numbers to host names

-P and -n will make the lookup faster

Example

List only files that listen to port 80

lsof -i:80 -P -n | grep LISTEN