O'Reilly logo

Mac OS X Tiger in a Nutshell by Jason McIntosh, Chuck Toporek, Chris Stone, Andy Lester

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

lsof

Synopsis

lsof [options] [pathname]

Lists open files, including regular files, directories, special files, libraries, network files, and others. The following descriptions and examples cover lsof's basic operation; for a complete description, refer to lsof's manpage.

Used without arguments, lsof lists all files opened by all active processes. Used with pathname, lsof lists the open files in the given filesystem mount point. If pathname is a file, lsof lists any processes having the given file open.

Options

-a

Recognize all list options as joined with "and" instead of the default "or."

-b

Avoid stat, lstat, and readlink functions, since they may block.

-c chars

List files opened by processes whose command names begin with characters chars. chars can contain a regular expression if put between slashes (/). You can further define the expression by following the closing slash with b to denote a basic expression, i to denote a case-insensitive expression, or x to denote an extended expression (the default).

+c width

Print up to width characters of the command associated with a process. If width is 0, all characters are printed.

+d pathname

List all open instances of the files and directories in pathname, including the directory pathname itself. This option doesn't search below the level of pathname, however.

+D pathname

List all open instances of the files and directories in pathname, including directory pathname itself, searching recursively to the full depth of directory pathname ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required