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:
- Cleared on Startup: Many Linux distributions (like Ubuntu, which is often used in LabEx) are configured to clear out the
/tmpdirectory during the boot process to ensure the system starts with a "clean slate." - RAM-based storage: On some modern Linux systems,
/tmpis actually mounted as atmpfs. 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. - Preventing Disk Clog: If files in
/tmpwere 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