Can i delete everything in /var/log? or should i only delete files (recursively) in /var/log but leave folders?
Does anyone have a good rm command? (my admin skills leave me nervous)
Note: I am using debian. I am not sure what version
feedback
|
|
Instead of deleting the files you should rotate them, e. g. using You never know when you'll actually need the logs from some time ago, so it's better to archive them (up to a reasonable age, e. g. 3 months).
| |||||
feedback
|
|
Delete all files:
Delete all .gz and rotated file
Try run command without "-delete", to test it. | |||
|
feedback
|
|
If you delete everything in /var/log, you will most likely end up with tons of error messages in very little time, since there are folders in there which are expected to exist (e.g. exim4, apache2, apt, cups, mysql, samba and more). Plus: there are some services or applications that will not create their log files, if they don't exist. They expect at least an empty file to be present. So the direct answer to your question actually is "Do not do this!!!". As joschi has pointed out, there is no reason to do this. I have debian servers running that haven't had a single log file deleted in years. | |||
|
feedback
|
|
You can use the option ctime to find old files... for example:
As bindbn explain, first try the find fetch files and after use the option delete :D | |||
|
feedback
|