↑ ↓ select, Enter open, Esc close

Find deleted files still held open

root@server
lsof -nP +L1

Lists all open files with a link count of 0, meaning files that have already been deleted. Their space is only freed once the process closes them. This explains why df reports a full disk while du counts much less. The SIZE/OFF column shows the size, COMMAND and PID the responsible process.

Note: Restarting the affected service usually fixes it. lsof is not always preinstalled (apt install lsof).

Also searched as

  • df shows full but du does not
  • disk space not freed after deleting files
  • deleted log file still using space
  • lsof deleted files

Related one-liners

All in Filesystem

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.