0

This is to keep temporary files I create and forget to delete from polluting my file system. Presumably the target directory could be named anything.

1 Answers1

1

Why not use the standard /tmp directory?

Either directly or via a symbolic link from your home directory.

ln -s /tmp ~

The symbolic link ~/tmp will behave like a directory and its content will be deleted at [re]boot.

sudodus
  • 46,324
  • 5
  • 88
  • 152
  • I've heard/read best practice is avoid doing home business in /. Symbolic link partially alleviates this concern... – Zach_is_my_name Jan 30 '17 at 18:52
  • Where did you hear that @Zach_is_my_name? – George Udosen Jan 30 '17 at 18:54
  • I cannot implicate any specific agents or parties at this time. – Zach_is_my_name Jan 30 '17 at 18:55
  • It is good rule of thumb, that you should not tamper with directories outside your home directory unless you know what you are doing. But /tmp is an exception. It is a directory for temporary files, that you can use manually, or via application programs. Many programs are using /tmp for temporary files. – sudodus Jan 30 '17 at 19:08
  • 1
    If you're worried about conflicting with names other users may have given to files in /tmp, use mktemp – KevinOrr Jan 30 '17 at 19:15
  • I'm pretty much sold. Supposing that I can create as many sym links as I want to /tmp for convenience? That should cover the original question and case. – Zach_is_my_name Jan 30 '17 at 20:34
  • Yes, it is possible to create more than one sym link pointing to /tmp, as many as you wish. – sudodus Jan 30 '17 at 20:39
  • Is it safe to link /tmp to ~ like that? Surely it is better to ln -s /tmp ~/somedir – Mark Kirby Jan 30 '17 at 21:27
  • The only difference will be the location of the link. Please tell us how it would be safer to locate it in a subdirectory. - But I use another method to 'houseclean' my home directory: I check the new files with newfiles n where newfiles is a script and n is the number of days back to be checked for mtime. – sudodus Jan 31 '17 at 05:15