Lsof

From Freephile Wiki
Jump to navigation Jump to search

LSOF - the utility with the most options ever

What application is spying on you today?[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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

Problems with NFS[edit | edit source]

Use lsof -N which selects the listing of NFS files

Is Sendmail or something running for mail?[edit | edit source]

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

Oh My GAWD, I deleted my Apache log[edit | edit source]

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[edit | edit source]