Find that ghost process holding onto your deleted files

Disk & Filesystem Management (Du/Df/Lsblk/Fstrim)

Find that ghost process holding onto your deleted files

🧩 The Challenge

Ever run df and see a disk at 100 percent, but then go into the directory and find nothing but a few kilobytes of logs? I’ve spent way too long rebooting services because some rogue process still has a file handle open on a deleted multi-gigabyte log file.

💡 The Fix

Use lsof to hunt down the exact process that’s keeping the space locked up even though the file is technically gone from the filesystem. Once you kill or restart that process, the space will actually reclaim.

lsof +L1

⚙️ Why It Works

This command scans all open file descriptors for any file with a link count of less than 1, which effectively means it’s deleted but still held in memory by a running process.

🚀 Pro-Tip: Pipe it to awk if you need to quickly grab the PIDs for a mass restart.

Linux Tips & Tricks | © ngelinux.com | 11/30/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted