# how do i delete log files on os x



## djc_nl (Nov 18, 2006)

how do u delete log files on os x? i tried in terminal (var/log) but i get permission denied.

anyone please


----------



## Natobasso (Nov 18, 2006)

Download OnyX for free:
http://www.titanium.free.fr/pgs/english.html

Make sure your user account is set up for admin too.


----------



## g/re/p (Nov 19, 2006)

djc_nl said:


> how do u delete log files on os x? i tried in terminal (var/log) but i get permission denied.
> 
> anyone please



I am fairly certain that you need to be logged in to an admin level account 
to delete from var/log.

In terminal you can type sudo -s and enter an admin password at 
the prompt - you should then be able to delete any logs choose.

I created an alias that changes the present working directory to 
/var/log and then escalates permission to super user level: 

 vlg='cd /var/log; sudo -s'

I created a simple shell script in the var/log directory that will empty
 and/or delete specific log files:

#!/bin/ksh      
#empty logs
echo "" > asl.log; echo "" > crashreporter.log; echo "" > ftp.log; echo "" > install.log; echo "" > ipfw.log; echo "" > lastlog; echo "" > lpr.log; echo "" > mail.log; echo "" > netinfo.log; echo "" > ppp.log; echo "" > secure.log; echo "" > system.log; echo "" > windowserver.log; echo "" > wtmp; 

#remove .gz logs
rm -R ftp.log.0.gz;rm -R ipfw.log.[0-9].gz; rm -R netinfo.log.[0-9].gz; 
rm -R lpr.log.[0-9].gz; rm -R ppp.log.[0-9].gz;rm -R system.log.[0-9].gz; rm -R mail.log.[0-9].gz; rm -R secure.log.[0-9].gz;rm -R wtmp.[0-9].gz; rm -R install.log.[0-9].gz; rm -R ftp.log.[0-9].gz


----------



## barhar (Nov 19, 2006)

'... i tried in terminal (var/log) but i get permission denied.' - enter ...

sudo bash

... and press the <return> key. When prompted for a 'password', enter it and press the <return> key. You may now perform 'root' level actions.


----------

