Home > bash > .xsession-errors can grow HUGE

.xsession-errors can grow HUGE

Problem
Something funny happened to me today. I logged in to my desktop machine at my workplace when a warning message told me that “disk space is low”. A quick “df -h” indicated that it’s true, my HDD is at 100%! How is it possible, I should occupy no more than 30%. After hunting for 10 minutes for the guilty file/directory, it turned out that the file .xsession-errors in my HOME directory grew more than 200GB! WTF?

Solution
I removed this file and under the name .xsession-errors I put a link on /dev/null. However, after a reboot the symbolic link was gone and .xsession-errors became a regular file again. Tricky :) So I added the following lines to the end of my .bashrc file:

# .xsession-errors can grow huge... remove it
if [ ! -h $HOME/.xsession-errors ]
then
    /bin/rm $HOME/.xsession-errors
    ln -s /dev/null $HOME/.xsession-errors
fi

if [ ! -h $HOME/.xsession-errors.old ]
then
    /bin/rm $HOME/.xsession-errors.old
    ln -s /dev/null $HOME/.xsession-errors.old
fi

It verifies if .xsession-errors is a symbolic link. If not, remove it and replace it with a symbolic link.

About these ads
  1. Arman
    February 2, 2013 at 03:00

    Had the same problem yesterday!
    thanks for the post!

  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 73 other followers

%d bloggers like this: