[GTALUG] suggestion: naming temp files

D. Hugh Redelmeier hugh at mimosa.com
Tue Apr 17 11:43:38 EDT 2018


I often want temp files.

Putting them in /tmp means that they will automatically be discarded
on reboot -- kind of handy.  But it means that they are public: they
are in a space shared with all other users (if you have other users).
I consider it a bad habit for that reason.

Lots of people put temp files in the current directory or in their home 
directory.  That's what I do.  But then, when you come back a week later, 
how do you know that this file is garbage?  The best way is to have a 
naming convention.

Many people use tmp, tmp2, tmp3 as names.  I find those visually too like 
real filenames and longer to type than I want.  The names I use are 0, 1, 
2, 3.  They are short, distinctive, and unreasonable as permanent 
filenames.

You can find the litter you left behind with:
	locate -r '/[0-9]$'
You will notice that the system does have some files that match too so
you cannot blindly delete all matches.

To me, it is obvious.  But I didn't think of it.  I copied this from Chris 
Sturgess almost 30 years ago.


More information about the talk mailing list