Forrest logo
back to context overview

lsof

List of commands for lsof:

  • lsof:tldr:055e0 lsof: Find the processes that have a given file open.
    $ lsof ${filename}
    try on your machine
    explain this command
  • lsof:tldr:0eb6b lsof: List files opened by a specific process, given its PID.
    $ lsof -p ${PID}
    try on your machine
    explain this command
  • lsof:tldr:1e9ee lsof: List files opened by the given user.
    $ lsof -u ${username}
    try on your machine
    explain this command
  • lsof:tldr:1ef8a lsof: List files opened by the given command or process.
    $ lsof -c ${process_or_command_name}
    try on your machine
    explain this command
  • lsof:tldr:24de7 lsof: Only output the process ID (PID).
    $ lsof -t ${filename}
    try on your machine
    explain this command
  • lsof:tldr:8d9eb lsof: List open files in a directory.
    $ lsof +D ${path-to-directory}
    try on your machine
    explain this command
  • lsof:tldr:ceae6 lsof: Find the process that is listening on a local IPv6 TCP port and don't convert network or port numbers.
    $ lsof -i6TCP:${port} -sTCP:LISTEN -n -P
    try on your machine
    explain this command
  • lsof:tldr:e93b3 lsof: Find the process that opened a local internet port.
    $ lsof -i :${port}
    try on your machine
    explain this command
back to context overview