Section #3. lsof

What Is It?

lsof stands for “LiSt Open Files.” This command seems deceptively simple: It lists information about files opened by processes on a UNIX box.

Despite its (apparent) modest mission statement, lsof is actually one of the most powerful and useful UNIX commands. Its raw power comes from one of UNIX’s design principle often described as “in UNIX everything is a file.”3 What this means is that the lsof concept of an open file not only covers regular files but also the following:

• Directories

• Streams or network files (for example, Internet or UNIX domain sockets and NFS files)

• Native libraries (for example, .so or .dylib dynamic libraries linked to a process)

• Block and character special files (for example, disk volume, ...

Get Troubleshooting Ruby Processes: Leveraging System Tools when the Usual Ruby Tricks Stop Working now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.