Simple command to reset / clear all logs?

Bob Hall rjhjr0 at gmail.com
Thu Jan 13 02:23:09 UTC 2011


On Wed, Jan 12, 2011 at 08:21:45PM +0100, Polytropon wrote:
> On Thu, 13 Jan 2011 02:17:10 +0900, Ryuichiro Hara <rhml at kibug.org> wrote:
> > Hello,
> > 
> > It might be all right to remove all "normal file" logs,
> > though you may want to retain all subdirectories.
> > 
> > find /var/log -type f -exec rm {} \;
> > 
> > may do.
> 
> Possible problem: Programs that log to files may be confused
> that the file has disappeared. How about simply cutting the
> files to zero length?
> 
> 	# cat /dev/null > /var/log/*

or	# truncate -s 0 /var/log/*

That will save you two keystrokes, and that's important! ;-) 


More information about the freebsd-questions mailing list