Sobes.tech
Junior — Middle

Why does the 'df -h' command in Linux not show freed space after deleting files?

sobes.tech AI

Answer from AI

The df -h command shows disk space usage at the filesystem level. If space is not freed after deleting files, it is usually because these files are still open by processes. In Linux, a file is removed from the directory, but if some process keeps it open with a descriptor, the disk space is not freed until the process closes the file.

To check which processes are holding deleted files, you can use the command:

lsof | grep '(deleted)'

After such processes are terminated or restarted, the space will be freed, and df -h will show the actual free space.