clean /tmp after reboot

Amedee Van Gasse (ub) amedee-ubuntu at amedee.be
Mon Feb 15 12:45:12 UTC 2010


On Mon, February 15, 2010 13:15, Max Freitag wrote:
> Hello,
>
> did someone now, how to clean the /tmp directory after a reboot? The
> "TMPTIME=0" in /ets/default/rcS is set but the /tmp is never empty.
>
> Anny Idea? I think only the files with me as owner will not be deletet.

I know of two ways to clean /tmp after a reboot:


1) mount /tmp (and /var/tmp) as a tmpfs (in memory). Only use that if you
have enough RAM. I have 6 GiB. Put the following in /etc/fstab:

tmpfs   /tmp       tmpfs   rw   0   0
tmpfs   /var/tmp   tmpfs   rw   0   0

A variation is:

none    /tmp       tmpfs   size=2G,nr_inodes=200k,mode=01777   0   0
none    /var/tmp   tmpfs   size=2G,nr_inodes=200k,mode=01777   0   0


2) Add this to /etc/rc.local, just above "exit 0":

rm -rf /tmp/.* /tmp/*


Both methods are not Ubuntu specific, they work for all Linux distributions.
In other words: these are probably not the "Ubuntu recommended" methods.
But they work.

-- 
Amedee





More information about the kubuntu-users mailing list