I often use the /tmp
directory on my Linux machine for storing temporary files (e.g. PDFs from a site that wants me to download it first etc.) and I often create a directory with my username. But at every startup it (including all files) gets deleted. Now I know I can put it in /var/tmp
, but I want all its contents to be deleted, but for the directory itself to be kept.
So:
tmp
|- me # this should stay
| |- foo1 # this should be deleted...
| |- bar1 # ...and this as well
|- other stuff...
Is there any way to do this? Maybe with permissions or with a special configuration?
/tmp
is likely atmpfs
filesystem. Those files aren't really deleted; they're simply stored in RAM and lost on a reboot. That's why you get answers that boil down to "re-create it on boot or login"