What happens to files in /tmp after reboot?

QuestionsQuestions8 SkillsProDec, 19 2025
0388

Great question! On most Linux systems, files in /tmp are deleted when the system reboots.

Here is a bit more detail on why and how that happens:

  1. Cleared on Startup: Many Linux distributions (like Ubuntu, which is often used in LabEx) are configured to clear out the /tmp directory during the boot process to ensure the system starts with a "clean slate."
  2. RAM-based storage: On some modern Linux systems, /tmp is actually mounted as a tmpfs. This means the files are stored directly in the computer's RAM (memory) rather than on the hard drive. Since RAM is volatile, everything is naturally lost as soon as the power is turned off.
  3. Preventing Disk Clog: If files in /tmp were never deleted, the system would eventually run out of disk space because programs often forget to "clean up" after themselves.

In short: If you save a file in /tmp today and the LabEx VM restarts or you come back to a fresh session later, that file will likely be gone. Always save your important work in your home directory (/home/labex/project) instead

0 Comments

no data
Be the first to share your comment!