LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-22-2012, 11:49 AM   #1
Kramerica
LQ Newbie
 
Registered: Jun 2012
Posts: 6

Rep: Reputation: Disabled
Clear All LOG Files


Hello. Is there a way from the command line to clear all log files (*.log and *_log)? I am in the process of moving several sites to a new server and the log files, which will be maintained on the old server, are huge. Thanks

OS - Centos 5
 
Old 06-22-2012, 11:58 AM   #2
harry edwards
Member
 
Registered: Nov 2007
Location: Lincolnshire, UK
Distribution: CentOS, Fedora, and Suse
Posts: 365

Rep: Reputation: 48
Assuming clear means remove and not empty. The find command would do it e.g.

Code:
find /some/location -type f -name "*.log" -exec rm {} \;

Last edited by harry edwards; 06-22-2012 at 11:59 AM.
 
Old 06-22-2012, 12:19 PM   #3
Ghostwheel
Member
 
Registered: Jun 2004
Location: Mid Michigan
Distribution: CentOS, Ubuntu
Posts: 41

Rep: Reputation: 0
or if you do mean to just empty them

Code:
find /some/location -type f -name "*.log" -exec cat /dev/null > {} \;
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to i clear all my apache log files? steve51184 Linux - Server 13 01-12-2011 01:40 AM
How to clear Log data paragkalra Linux - Security 2 10-05-2007 02:43 AM
HOW TO: clear the console log? markg85 Linux - General 7 05-04-2006 03:42 AM
script to clear log files kushalkoolwal Programming 8 01-24-2006 07:11 PM
Help! Clear web.cache and log files on server DogByte Linux - Newbie 1 09-20-2005 06:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration