The peril of /tmp
Published on 19th July 2008 Estimated Reading Time: 1 minuteBy default, I think that Windows plants its temporary files in c:\windows\temp
. On Linux or on Ubuntu at least, the equivalent area is /tmp
. However, not realising that /tmp
when you shut down and start your PC could cause the silly blunder that I made today. I was doing a spot of reorganisation on my spare PC when I dumped some files in /tmp
from a hard drive that I had added. I was reformatting the drive as ext3
following its NTFS former life. As part of this, I was editing fstab
to automatically mount the thing and a system restart ensued. I ended up losing whatever I put into /tmp
, a very silly blunder. Luckily, I had the good sense not to put anything critical in there, so nothing of consequence has been lost. Nevertheless, a lesson has been learnt: Windows allows its temporary area to pick up all kinds of clutter until you clear it, while Linux clears the thing regularly. It's remarkable how Windows thinking can cause a howler when you have a lapse of concentration using a *NIX operating system, even for someone who uses the latter every day.
I'm not sure of the file to edit in the case of Ubuntu, which you're using, but for Gentoo it is possible to specify whether or not /tmp/ is emptied automatically by assigning the environment variable WIPE_TMP in the file /etc/conf.d/bootmisc. I made WIPE_TMP="yes" so that the /tmp/ directory is cleared on each boot, otherwise the contents of this directory can build up over time as with Windows.