The Hidden Disk Consumer
When running a graphical desktop environment on Ubuntu, the X11 display server and your desktop environment (like GNOME) continuously log non-critical warnings, deprecated software notifications, and minor graphical glitches. By default, these logs are dumped directly into a hidden file named .xsession-errors located in your Home directory. Over time, particularly if you run poorly optimized applications or third-party extensions, this text file can silently balloon to several gigabytes in size, consuming valuable SSD space and creating unnecessary write operations.
Redirecting the Output
Because the X session logging is deeply embedded in how the desktop environment initializes, there is no graphical setting to simply turn it off. Instead, you must trick the operating system by securely redirecting the file’s output stream into a virtual black hole, ensuring the log file can never actually write data to your physical storage.
Open a terminal window (Ctrl+Alt+T). First, delete the existing bloated log file by typing rm ~/.xsession-errors and pressing Enter. Next, you must create a symbolic link that points the filename directly to the Linux null device. Type exactly: ln -s /dev/null ~/.xsession-errors and press Enter. Now, whenever the graphical server attempts to write an error to that specific filename, the data is instantly discarded by the null device, permanently preventing the log file from taking up physical disk space.