Clearing Deleted Files WITHOUT an Application Restart

Ever deleted a file and wondered why the disk space hasn't cleared?
Chances are the application is still keeping the old file open.
One way to “release” the file is to restart the application, however 99% of the time this is NOT ideal!!

1) First we find the file descriptor for the offending file.
NOTE: you may be spammed with a lot of files from /tmp/ or similar directorys. Find the appropriate file for your situation.

find /proc/*/fd -ls | grep  '(deleted)'
Get the file descriptor from the deleted file, it will look similar to:
/proc/6755/fd/6
Once you have this we can delete the file by emptying it. Replacing the following command with the $pid and $fd we got above:
> "/proc/$pid/fd/$fd"
Example:
> "/proc/6755/fd/6"



JUST ECHO NOTHING INTO THE FILE

Instead of deleting large files, simpy echo “” into it:

echo "" > /var/log/httpd/large_access.log