How to zero out a logfiles

Stephen Carville stephen at
Wed Mar 31 20:52:40 EST 2004

On Wednesday March 31 2004 01:16 pm, Jim Horwath wrote:
> Hi all,
> I have been using sudo for a few months and I'm still
> learning the ropes.  I need to zero a logfile with sudo, but
> I can't get the '>' syntax just right.  I tried to search
> the archives but didn't find any hints.  I can't be the
> first (or last) person who wants to do this.
> For example:
> sudo echo > /var/adm/logfile
> or something similiar

The only way I know how is:

echo | sudo tee /var/log/admfile

Stephen Carville
UNIX and Network Administrator
stephen at
If you have been voting for politicians who promise to give you goodies at 
someone else's expense, then you have no right to complain when they take 
your money and give it to someone else, including themselves.
      --Thomas Sowell (1992)

More information about the sudo-users mailing list