Truncate

truncate full


: > mylog.log

truncate keeping latest entries


echo "$(tail -1000 mylog.log)" > mylog.log

find deleted files still opened


find /proc/*/fd -ls | grep  '(deleted)'
lsof -nP | grep '(deleted)'

truncate file descriptor


: > "/proc/$pid/fd/$fd"

Last modified: Thu Jan 8 09:59:18 2026