Open main menu

LSOF - the utility with the most options ever

What application is spying on you today?

lsof -i will show you the open internet connections to your server. You may discover some strange (outbound) connections that you didn't know about and don't recognize. http://www.tcpiputils.com/ is an interesting service that provides quick access to some network tools to help you determine what/who those parties are.

How do you see a process change over time

You could normally use watch --differences --interval 1 to show things change. But my QNAP NAS doesn't have the watch command. The lsof command has an interval capability with the +-r option

MySQL is running, but non-standard

Use lsof -i -a -c mysql for Internet and command mysql

Problems with NFS

Use lsof -N which selects the listing of NFS files

Is Sendmail or something running for mail?

Use lsof -i :25 which shows everything running on port 25

Oh My GAWD, I deleted my Apache log

It's possible, if the deleted file is still being held open by a daemon or process, to save the contents of the deleted file. You can find out by using lsof. See the IBM article below.

More reading