Lsof

From Colettapedia
Jump to navigation Jump to search

General

  • command meaning "list open files", which is used in many Unix-like systems to report a list of all open files and the processes that opened them.
  • Open files in the system include disk files, pipes, network sockets and devices opened by all processes.
  • One use for this command is when a disk cannot be unmounted because (unspecified) files are in use.
  • The listing of open files can be consulted (suitably filtered if necessary) to identify the process that is using the files.

Fixing Conflicting Socket Issues

  1. Check the port CUPS is listening (/etc/services).
  2. Check who is using that port using ( lsof -i:[PORT] or netstat -na |grep LISTEN|grep [PORT])
  3. Move that app to a different port if it is using cups port.

Examples

  • lsof -i tcp:5439 results in:
COMMAND    PID     USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
com.docke 2869 ccoletta  279u  IPv4 0xb85437f7dd29e70b      0t0  TCP localhost:5439 (LISTEN)