←back to thread

Against /Tmp

(dotat.at)
140 points todsacerdoti | 1 comments | | HN request time: 0s | source
Show context
tmountain ◴[] No.41913914[source]
Things goes along with the author's "tmp cleanup" section, but I have lost valuable work on a number of occasions from hacking on random files that I created in /tmp under the assumption that they were throwaway junk files, only to reboot my machine a few hours later and have them automatically deleted by the OS. It's much safer and just as easy to use a "$HOME/tmp" dir as a junk drawer and then manually clean it up from time to time.
replies(4): >>41913944 #>>41913967 #>>41914063 #>>41914729 #
akdev1l ◴[] No.41914063[source]
You can use /var/tmp for this purpose

It is not cleared between reboots

replies(2): >>41914167 #>>41914745 #
1. NekkoDroid ◴[] No.41914745[source]
Do note that systemd does have a tmpfiles.d (terrible name nowadays, but that is besides the point) drop-in with an extra service that will clean out /var/tmp/ of unused files when they haven't been accessed within 30 days (all of a/m/ctime are checked). Same applies to /tmp/ but with 10 days. I don't know if the service is enable by default on any distros though, so assume it is unless otherwise ensured :)