Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'd like to make a folder in my GNU/Linux home directory that behaves somewhat like TMPDIR (usually /tmp or /var/tmp); that is, a folder that deletes its contents on reboot or after they've started gathering cobwebs. What's the best way to go about this?

Note that I do not want to simply move the tmp dir to home.

share|improve this question

2 Answers 2

up vote 6 down vote accepted

It doesn't "delete on reboot"; it only exists in RAM in the first place. Mount tmpfs to a directory under your home directory.

share|improve this answer
    
Is there supposed to be a tmpfs file in /dev? There's not one on my system. Or have I misunderstood? –  Cameron Jul 1 '11 at 3:35
2  
tmpfs is a virtual filesystem, just like proc or sysfs. You can use the name directly without specifying a device file. –  Ignacio Vazquez-Abrams Jul 1 '11 at 3:36

Put the following in your user's crontab:

@reboot rm -rf /home/user/path/*
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.