PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minute/tmp is Linux’s standard location for temporary files: data an application can recreate or no longer needs after its task. Whether its contents survive a reboot, and how long they remain, depends on the system’s configuration. On many systemd-based systems, /tmp is backed by temporary memory storage and cleared at reboot; use /var/tmp for temporary data that must persist across a reboot.
What is /tmp in Linux?
The Filesystem Hierarchy Standard (FHS) defines /tmp as a directory for temporary files. It is a shared location that programs and users can use for short-lived data, such as intermediate files. The FHS describes the directory’s purpose; it does not dictate one universal cleanup schedule or backing storage.
On systemd-managed Linux systems, /tmp and /var/tmp are world-writable directories for temporary files. Because many users and programs share /tmp, applications should create uniquely named files or directories with secure operating-system APIs rather than predictable names. This helps avoid collisions and security problems.
Does /tmp get deleted when you reboot?
Often, but not on every Linux system. The systemd project documents that /tmp is typically mounted as tmpfs, backed by RAM and possibly swap, and flushed at reboot. Distributions and administrators can configure a different mount type or reboot-cleanup behavior, so the directory name alone does not guarantee that files will disappear.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →#1 Best Overall
If temporary data must remain available across a reboot, put it in /var/tmp. Do not treat either directory as durable storage for important data.
How long do files stay in /tmp and /var/tmp?
The systemd project’s documented defaults are 10 days for files in /tmp and 30 days for files in /var/tmp. These are age-based cleanup defaults, not guaranteed minimum retention periods: reboot cleanup may clear /tmp sooner, and distribution or administrator settings can change the policy.
Rank #2
Should you use /tmp or /var/tmp?
| Question | /tmp |
/var/tmp |
|---|---|---|
| Reboot persistence | May be cleared at reboot on common systemd configurations. | Intended for temporary files that need to persist across a reboot. |
| Typical backing storage | Often tmpfs, backed by RAM and possibly swap, on systemd systems. |
Persistent filesystem; exact backing depends on system configuration. |
| systemd default age-based cleanup | 10 days. | 30 days. |
| Suitable data | Short-lived data that can be safely recreated or discarded. | Temporary data that should survive reboot but can eventually be removed. |
Choose based on the data’s recovery needs, not just the longer default cleanup period. For data that must survive beyond temporary-file cleanup, use an appropriate persistent application or user data location instead.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Who cleans /tmp, and how is cleanup configured?
On systemd systems, systemd-tmpfiles creates, removes, and cleans files and directories according to tmpfiles.d configuration. System units run it during setup and scheduled cleanup. The documented 10-day and 30-day ageing rules are defaults; distribution packages or administrator configuration can alter them.
Free tools Windows power users keep installed
One-click scans. No signup required.
Other Linux setups may use different mechanisms. The FHS assigns the directory’s purpose, while systemd’s tmpfiles policy is one implementation of its creation and cleanup.
Quick Recap
Best Value
Rank #4
How should applications handle temporary files?
- Honor
$TMPDIR. If the environment variable is set, use the caller-selected temporary directory rather than assuming files must go in/tmp. - Use secure creation APIs. Create unpredictable, unique names and directories through operating-system facilities; do not check for a name and then create it later, or use a predictable shared filename.
- Keep a file descriptor open when needed. If temporary data must remain available while a process runs, keep its file descriptor open rather than relying only on a pathname that cleanup may remove.
- Use a private runtime or state directory when cleanup is unsuitable. Temporary-file directories are designed for data that can be cleaned; choose a better-managed location for data that has different lifetime or privacy requirements.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

