I have Linux red-hat machine And I not sure what the concept about the directory /tmp
How to know if the files under /tmp will deleted after reboot or maybe will deleted after some time
Which file/configuration in my Linux machine responsible for that ? And if it possible to change the rules there?
remark my crontab is empty - no deleted Job there
This is specified in the File Hierarchy Standard and Linux Standard Base
/tmp/
is oftentmpfs
mounted, and on systems where it is not the case, the boot init scripts should (and usually do) clean it.So files under
/tmp/
do not survive a reboot. Put them elsewhere (perhaps/var/tmp/
) if you want them to survive a reboot.In the FHS §2.3:
So unless your systems are very badly misconfigured, you should presume that
/tmp/
is cleaned at least at reboot time. BTW, some sysadmins are setting acrontab
entry to clean old files (e.g. weekly clean older than 2 weeks file). See also tmpfiles.d(5), TMPDIR, mkstemp(3), crontab(5), POSIX tmpfile & tmpnam