I have several lighttpd servers running on an Arch Linux machine, all for local network use only. I want to know which lighttpd server is watching which port. 'ps aux | grep light' lists them all by process id, but provides no clues about port number. What commands can I use to find out which process id goes with which port?

  • @DarenW Use the lsof command. See Option #1 here and look for the name of the application followed by the TCP listen address and port for each process.
    – dan
    Sep 7, 2020 at 5:26

1 Answer 1


I have found a command to do the job.

ss -4 -l -p -t  -n |  grep light  

Typical output looks like

LISTEN 0      1024*    users:(("lighttpd",pid=1475828,fd=3))
LISTEN 0      1024*    users:(("lighttpd",pid=252797,fd=3)) 

The "4" may be left off to see IPv6, but for my LAN it's all IPv4. "-l" for LISTEN, "-p" shows port numbers, "-t" for TCP (not UDP) and "-n" shows ports as numbers not meaningful names, though there probably won't be any with user-defined port numbers like 7880 set in lighttp.conf files. Grep filters the lighttpd servers (I don't care about other http servers, if any).

I have never heard of the "ss" command until recently. Maybe I should spend a day reading a Linux system administration guide - things have changed!

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.