Blog

Deleting an Open File in Linux

Posted on in For Geeks Only

Some applications such as Apache need to be restarted after deleting a log file.  One way to clear out the contents of a log file is to simply write the contents of /dev/null to the file by using the following command:

cat /dev/null > <somefile>

My guess is that this works because the file preserves the same inode so that the application can continue to write to the file.

Leave a Reply

What our clients are saying

I want to thank you for your help with our website development project. Your programming skills, attention to detail, and ability to interact directly with our client were excellent. You have provided tremendous value to my organization. With a project of this magnitude, including the use of web services to push data out to 19 sub-websites, your ability to overcome our unique challenges and coordinate with my IT team was exceptional. I appreciate your help, and I am certain that your expertise was key to the project's success. Thanks again, I look forward to working with you on our next endeavor!

~ John Forgione – Executive Vice President – SFA Marketing, Inc.

Read More