Linux has no single, system-wide time when /tmp is cleared. On systems using the documented systemd defaults, systemd-tmpfiles removes files from /tmp when they reach an age of 10 days. The corresponding default for /var/tmp is 30 days. Cleanup is normally run by systemd-tmpfiles-clean.service, triggered by systemd-tmpfiles-clean.timer. A reboot may remove files on some systems, but it is neither the universal trigger nor a reliable schedule.
Need a server to try this on? Antihost offers Linux VPS plans with NVMe storage, full root access and a 14-day free trial.
The short answer: age-based cleanup, not a Linux-wide clock
The answer to “When does Linux clear /tmp?” depends on the distribution, the init system, the mount used for /tmp, and local administrator rules. There is no rule that every Linux machine empties the directory at shutdown, at boot, or at a particular time of day.
As an Amazon Associate I earn from qualifying purchases.
On a host using the upstream systemd policy, files in /tmp are cleaned after they have reached 10 days of age. Files in /var/tmp have a 30-day default. Those numbers are maximum ages in the cleanup policy, not promises that deletion occurs exactly at the instant the limit is reached. The timer must run, and the file must match an applicable rule.
The policy is implemented by systemd-tmpfiles. Its cleanup operation evaluates the age parameters in tmpfiles.d rules and removes files and directories that qualify. The normal service and timer provide the recurring execution.
#1 Best Overall
- [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
- [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
- [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
- [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
- [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
What actually performs the cleanup
systemd-tmpfiles-clean.timer schedules the work
The timer starts systemd-tmpfiles-clean.service. The service invokes systemd-tmpfiles to apply the configured age rules across the system. Because the timer is a system unit, it can clean directories for all users, not just the account that created a file.
The timer’s exact calendar and any delay should be checked on the machine rather than assumed. A file that is 10 days old can remain until the next successful cleanup run, while a local rule can make the effective age shorter or longer.
tmpfiles.d supplies the rules
systemd-tmpfiles reads configuration from the installed system’s tmpfiles.d search path. The usual locations are:
/etc/tmpfiles.d/for administrator-created overrides and site policy./run/tmpfiles.d/for run-time-generated policy./usr/lib/tmpfiles.d/for rules supplied by installed packages.
Administrator rules in /etc/tmpfiles.d/ take precedence according to the system’s configuration lookup rules. A local rule can alter the age, exclude a path, create a directory, or request removal during an early-boot pass. Consequently, the upstream 10-day value is a useful baseline, not proof of what a particular host will do.
Does Linux delete /tmp on reboot?
Sometimes, but not universally. Two separate mechanisms are often confused:
Rank #2
- 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
- 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
- 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
- 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
- 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
- Age-based cleanup: the systemd timer removes entries that satisfy their configured age. This can happen while the system is running, without a reboot.
- Filesystem lifecycle: if
/tmpis mounted as a volatiletmpfs, its contents normally exist only while that filesystem instance exists. Unmounting it, including during a shutdown, discards its contents.
A persistent filesystem mounted at /tmp can retain files across a reboot if no boot-time rule or age-based cleanup removes them. Conversely, a volatile mount can lose them even when their age is only a few seconds. The mount type and boot configuration therefore matter as much as the directory name.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Some tmpfiles.d rules are intended for the early-boot operation. The systemd-tmpfiles --boot mode applies those rules. A distribution may use such rules to remove selected entries when boot starts, independently of the recurring clean timer.
How to find the policy on your machine
Use the following checks before relying on a temporary file for a job, build, socket, lock, or hand-off between processes.
- Check the timer state and next run. Run
systemctl status systemd-tmpfiles-clean.timer. This shows whether the timer is enabled and active. Then runsystemctl list-timers systemd-tmpfiles-clean.timerto see the last and next scheduled activation. - Check the cleanup service. Run
systemctl status systemd-tmpfiles-clean.service. A failed, masked, or repeatedly failing service explains why old entries remain or why cleanup is not happening as expected. - Read the effective rules. Inspect matching files under
/etc/tmpfiles.d/,/run/tmpfiles.d/, and/usr/lib/tmpfiles.d/. Search for rules covering/tmp,/var/tmp, or a parent path. Read the installedtmpfiles.dmanual for the rule type and age-field syntax used by that release. - Check the mount. Use
findmnt /tmp(or the system’s equivalent mount inspection command) to determine whether/tmpis a normal persistent filesystem or atmpfs. A volatile mount changes the answer after reboot or unmount. - Review recent service logs. Use
journalctl -u systemd-tmpfiles-clean.serviceto see cleanup runs and reported errors. Logs can distinguish a successful deletion pass from a timer that never activated.
These checks provide a machine-specific answer: which policy applies, when it last ran, when it is expected to run again, and whether the directory itself is volatile.
What the 10-day and 30-day defaults mean
| Path | Documented upstream systemd default age | What controls deletion |
|---|---|---|
/tmp |
10 days | Applicable tmpfiles.d age rule and a successful systemd-tmpfiles cleanup run |
/var/tmp |
30 days | Applicable tmpfiles.d age rule and a successful systemd-tmpfiles cleanup run |
The defaults describe file age, not a fixed deletion timestamp. A file’s relevant timestamps and the rule’s semantics determine whether it qualifies. Cleanup can also be constrained by permissions, mount state, locks, or other filesystem conditions. Never treat “10 days” as a retention guarantee for important data.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Rank #3
- [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
- [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
- [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
- [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
- [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
Why a file in /tmp disappeared
It crossed the configured age threshold
The most common explanation is that a timer run found the file old enough under the active rule. A local administrator may have configured an age shorter than the upstream default, so inspect the effective files instead of assuming 10 days.
The machine rebooted or the mount was recreated
If /tmp is a volatile tmpfs, rebooting, changing mounts, or otherwise recreating that filesystem removes its contents. This loss is a property of the mount lifecycle, not evidence that the 10-day timer ran.
An early-boot rule removed it
A rule marked for boot-time processing can delete or recreate entries during startup. This is especially relevant when a file survives normal runtime but vanishes after a restart.
Another program removed it
Applications, package managers, service supervisors, installers, and user cleanup scripts can remove files in /tmp. If the systemd service log shows no relevant deletion and the mount is persistent, audit the application and user-level jobs that write there.
Recommended Free Tools
The file was never where you thought
Containers, chroots, sandboxes, and per-service namespaces can expose a different /tmp from the host. Check the path from the same execution context as the process that created the file. A host inspection may not show a container’s temporary directory, and vice versa.
Rank #4
- Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
- Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
- All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
- Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
- Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
How to run or test cleanup safely
systemd-tmpfiles --clean applies the configured age-based cleanup rules. Running it manually can remove every matching entry system-wide, so use it only when you understand the active policy and have administrative authorization. Read the installed manual for preview or dry-run options available on that system before performing a destructive test.
After changing a rule, restart systemd-tmpfiles-clean.service so safe runtime changes are applied to the service. Also verify the timer and inspect the journal. A syntax error, wrong path, or override with higher precedence can make a seemingly correct change ineffective.
How to keep data that must survive cleanup
Use a persistent application directory
Do not store durable output, queued work, credentials, caches that must be retained, or user documents in /tmp. Place them in an application-specific directory on a persistent filesystem, with ownership and permissions appropriate to the service. Use /var/tmp only when the data is genuinely temporary but needs a longer default lifetime; it is still subject to policy and is not a backup location.
Create an intentional policy exception
If a temporary path must remain longer, add a documented tmpfiles.d rule or exclusion through the supported configuration mechanism for the distribution. Put administrator policy in /etc/tmpfiles.d/, verify that it overrides the packaged rule as intended, and test the result with the installed systemd-tmpfiles documentation. Keep the exception narrow: exempting all of /tmp defeats its purpose and can allow unbounded disk consumption.
Design for disappearance anyway
Even an exemption does not protect against a volatile mount, manual deletion, filesystem repair, container teardown, or an application restart that recreates its workspace. A robust program treats /tmp as disposable, recreates missing directories, writes atomically, and stores any irreplaceable state elsewhere.
Best Value
Distribution and host differences
Modern systemd-based distributions commonly use the service-and-timer model, but not every Linux installation has the same implementation. Older systems or systems using a different init setup may rely on legacy boot scripts, cron jobs, or distribution-specific temporary-file cleaners. Their retention periods and run schedules can differ from the upstream systemd values.
Debian 13 release guidance explicitly warns that new installations regularly delete old files in both /tmp and /var/tmp while the system is running. That warning is important because it rules out a common assumption: waiting for a reboot is not necessary for cleanup on that release. The same principle applies to any distribution that schedules recurring cleanup.
When comparing machines, compare the mechanism, age threshold, timer cadence, boot-time rules, mount type, and local overrides. Comparing distribution names alone cannot predict when an individual file will disappear.
A practical decision guide
- Need a file for minutes or hours:
/tmpis appropriate, provided the program can recreate it. - Need temporary data across reboots: use a persistent application directory and define its own retention policy; do not rely on
/tmp. - Need a temporary file for more than 10 days: inspect the active rule first. The upstream default will not provide that retention in
/tmp. - Need to diagnose an unexpected deletion: check the timer, service journal, effective
tmpfiles.dfiles, mount type, boot events, and application logs in that order. - Need to change retention: make a narrow administrator override, validate its precedence and syntax, restart the cleanup service when appropriate, and monitor disk usage.
Bottom line for “How long do files stay in /tmp?”
On an unmodified systemd installation, the documented policy is 10 days for /tmp and 30 days for /var/tmp, enforced by recurring systemd-tmpfiles cleanup. Those are defaults, not universal guarantees. A volatile /tmp mount can empty at reboot, boot-time rules can remove entries during startup, and administrator or distribution-specific configuration can change every threshold. Check the timer, rules, service logs, and mount on the machine whose files matter.
Quick Recap
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.




