CodePark/ questions / Debugging a server in production
START PRACTICINGPRACTICE
Backend question · OS, networking & Linux › Debugging a server in production

Which command shows which process is listening on TCP port 3000?

lsof -i :3000

lsof -i :3000 lists the processes that have sockets on that port, with their PIDs. Use sudo to see processes owned by other users. ss -ltnp shows the same for listening sockets.

Why the others are wrong:

•
ps aux | grep 3000 only matches the text "3000" in command lines.
•
netstat -r prints the routing table.
•
df -i shows inode usage on disks.