lsof — List Open Files

lsof lists open files on a Linux or Unix system. It is useful because sockets, devices, directories and regular files can all appear as open files.

Find which process is using a port

lsof -i :8080

List open files for a process

lsof -p 1234

List files opened by a user

lsof -u username

This command is helpful when troubleshooting ports, locked files, deleted files still held open by a process, or unexpected file usage.

Leave a Comment