How to zero out a logfiles
Todd C. Miller
Todd.Miller at courtesan.com
Wed Mar 31 21:47:05 EST 2004
In message <E1B8n4S-0006Ec-00 at smtp03.mrf.mail.rcn.net>
so spake Jim Horwath (jim.horwath):
> 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
The problem here is that all you are running via sudo is "echo",
the redirection is done by your shell. If you want to zero
out a file, I would suggest:
sudo cp /dev/null /var/adm/logfile
- todd
More information about the sudo-users
mailing list