lsof

Lists open files and the corresponding processes.
Note: Root privileges (or sudo) is required to list files opened by others.
More information.
lsof {path/to/file}
lsof -i :{port}
lsof -t {path/to/file}
lsof -u {username}
lsof -c {process_or_command_name}
lsof -p {PID}
lsof +D {path/to/directory}
lsof -i6TCP:{port} -sTCP:LISTEN -n -P
Copyright © 2014—present the tldr-pages team and contributors.
This work is licensed under the Creative Commons Attribution 4.0 International License (CC-BY).
CC-BY