The peril of /tmp

By default, I think that Windows plants its temporary files in c:\windows\temp. In Linux or in 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 automount 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 amazing 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.

One comment

  1. Fitzcarraldo says:

    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.

  • As is commonly the case with places like these, all the views that you find expressed on here in postings and articles are mine alone and not those of any organisation with which I have any association, through work or otherwise. With regards to any comments left on the site, I reserve the right to reject any that are inappropriate. Otherwise, whatever is said is the sole responsibility of whoever is leaving the comment.