Find and remove large files that are open but have been deleted | find /folder/ -printf '%s %p \n' | sort -nr | head -10

Find top large files:
find /folder/ -printf '%s %p \n' | sort -rh | head -10

find -type f -exec du -Sh {} + | sort -rh | head -n 5

To truncate it:
: > /path/to/the/file.log
If it was already deleted, on Linux, you can still truncate it by doing:
: > "/proc/$pid/fd/$fd"

Where $pid is the process id of the process that has the file opened, and $fd one file descriptor it has it opened under (which you can check with lsof -p "$pid".
If you don't know the pid, and are looking for deleted files, you can do:
lsof -nP | grep '(deleted)'


Comments

Popular posts from this blog

HAproxy logging

teamcity Automatic Agent Start under Linux

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all