February 16, 2019

See which sockets belong to which processes

With lsof

  • October 31, 1999
  • By James Andrews
lsof | grep -i "program"

lsof or "list open files" is one of the systems administrator's number one tools. On a busy server it can help you trace what processes are using which services, without turning any serivces on and off to check what dies.

For many situations, lsof can provide vital clues you really shouldn't be without! All the distributions include it as a package. It is usually best to install from source, though, if you are upgrading the kernel regularly. This is because it really "gets inside" the kernel, and kernel upgrades often break it. I keep a copy in /usr/src and compile when I need it.

Most Popular LinuxPlanet Stories