Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My ~/.xsession-errors file grows very fast and I'd like to set a limit on its size. How?

share|improve this question
up vote 4 down vote accepted

You should realy try to solve the problems that cause the file to grow.

share|improve this answer
Sure! But the thing is some packaged applications write their logs there because of some inner issues and it's not my fault :) – kolypto Jul 1 '10 at 12:58
@o_O: Then that's the problem you need to solve, not this one. – Ignacio Vazquez-Abrams Jul 1 '10 at 16:10

One idea is to install a cron job that moves the file away when it grows too large, with a line similar to (untested)

0,31 * * * *  f=$HOME/; wc -c < $f | perl -lne 'exit ($_ > 1024*1024)' || mv $f $f.bak


man 5 crontab

for details.

share|improve this answer
Usually removing/truncating is not a good idea for logs: the application that writes there will still have the file handle opened. So, the file either continues to grow even though it was deleted. There should be a way to tell Xorg to reopen its log files. – kolypto Jul 1 '10 at 13:02
Ouch. You're right, Xorg keeps the logfile open, and there doesn't appear to be a signal you can send it to make it reopen its logfile, so my idea doesn't work. – reinierpost Jul 5 '10 at 8:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.