Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Feb 132010
 

How to check the logrotate status?

Answer:

To check the current logrotate status, e.g. which files are covered by logrotate, what are their last processed date etc.

You can check the /var/lib/logrotate/status file

# cat /var/lib/logrotate/status

"/var/log/apache2/access.log" 2008-12-7
"/var/log/apache2/error.log" 2009-1-25
"/var/log/apache2/other_vhosts_access.log" 2009-1-25
"/var/log/apt/term.log" 2010-2-1

...
Feb 082010
 

sed: replace in place

Answer:

Newer version of sed allow you replace a file in place, no more redirection is needed.

# sed -i 's/abc/def/g' test.txt

The above command will replace all "abc" to "def" in the file test.txt