brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: lsof -i :8080 names the linux process that holds a port

Linux
~/tips/tip-linux-lsof-i-port-holder

sudo lsof -nP -i :53

Shows which process is listening on a given port, with its PID and owner.

When a service says the address is already in use, I want the process name and user right away.

sudo lsof -nP -iTCP:8080 -sTCP:LISTEN
sudo lsof -nP -i :53

-i :8080 selects network files on that port. -sTCP:LISTEN keeps only listening sockets, so clients that merely connect do not clutter the list. -n and -P stop lsof from resolving host and port names, which makes it faster. The output shows the command, PID and user. Without sudo you only see your own processes, so a root-owned daemon can look like an empty result.

Further reading: lsof manual page

More Linux tips a2query -m rewrite renice -n 10 -p 4242 cat config.yml | xsel -ib xvfb-run -a your-program --some-flag dpkg --get-selections > packages.txt All Linux tips (261) All topics

Link