Skip to main content
InterviewHubPRO
Section Overview
Q26

Question 26 of 50

Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

52%
Linux OS Internals (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

What is `lsof` and how do you find open ports, deleted files, and active connections?

senior Levellinux-osAdvanced Internals

In Simple Words: "List Open Files" (lsof) displays all active file descriptors across the OS:

  • lsof -i :8080: Finds which process is listening on or connected to port 8080.
  • lsof -u appuser: Lists all files opened by a specific user.
  • Find Deleted Files Holding Disk Space: lsof +L1 (or lsof | grep deleted): Finds files that were deleted (rm file.log) but are still held open by a running process, preventing disk space from being freed!