How to Clean Up /tmp on Linux
Clear temporary files from /tmp on Linux and reclaim storage space using Kudu.
By Kudu Team
Fix this automatically with Kudu
Run a free system scan to detect and resolve this issue automatically — no manual steps required.
Download Kudu Free →What Causes This?
The /tmp folder on Linux is used by the system and apps to store temporary files like installers, caches, session data, and leftover working files. Over time, these files can pile up if programs do not clean up after themselves, especially after crashes, updates, or long uptime. Large downloads, package manager activity, and misbehaving apps can also leave behind files that waste disk space.
Common Symptoms
- You are running low on disk space for no obvious reason
- The system feels cluttered after updates or app installs
- You see large files or many old folders inside
/tmp - Some apps fail because the disk is nearly full
- Storage analysis tools show
/tmpusing more space than expected
How to Fix It Manually
-
Check how much space
/tmpis using- Open a Terminal.
- Run:
sudo du -sh /tmp - This shows the total size of the
/tmpfolder so you can confirm whether it is worth cleaning.
-
List the largest files and folders
- In Terminal, run:
sudo du -ah /tmp | sort -rh | head -20 - Review the output for unusually large files or folders.
- Be careful not to delete files currently being used by running programs.
- In Terminal, run:
-
Remove old temporary files
- A safe first step is to delete files that have not been accessed in several days:
sudo find /tmp -type f -atime +3 -delete - This removes regular files in
/tmpthat have not been accessed in more than 3 days. - If you want to preview files before deleting them, run the same command without
-delete:sudo find /tmp -type f -atime +3
- A safe first step is to delete files that have not been accessed in several days:
-
Delete specific large files or folders manually
- If you found obvious leftovers in step 2, remove them directly:
sudo rm -rf /tmp/folder-name sudo rm -f /tmp/file-name - Only delete items you recognize as temporary or abandoned.
- Avoid deleting sockets, lock files, or files tied to currently open apps unless you are sure they are no longer needed.
- If you found obvious leftovers in step 2, remove them directly:
-
Clean
/tmpduring a reboot if needed- Many Linux systems clear some or all of
/tmpautomatically on reboot. - Save your work and restart the computer:
sudo reboot - After rebooting, check usage again:
sudo du -sh /tmp
- Many Linux systems clear some or all of
-
Use systemd-tmpfiles to clean temporary data
- On systems using
systemd, run:sudo systemd-tmpfiles --clean - This applies your system’s configured cleanup rules for temporary files.
- Then verify the result:
sudo du -sh /tmp
- On systems using
-
Prevent the problem from coming back
- Reboot occasionally if your system stays up for long periods.
- Check for apps that repeatedly dump large files into
/tmp. - If one program keeps filling the folder, update or reinstall that app.
Fix It Automatically with Kudu
If you do not want to inspect temporary files by hand, Kudu can scan your system, find junk and leftover temporary data, and help remove it safely. It is an easier way to reclaim storage without digging through folders or guessing what can be deleted.
Fix this automatically with Kudu
Run a free system scan to detect and resolve this issue automatically — no manual steps required.
Download Kudu Free →Related guides
How to Clean Up the Downloads Folder on Linux
Organize and remove old files from your Linux Downloads folder with Kudu to reclaim disk space.
How to Clean Up Flatpak Files on Linux
Remove unused Flatpak runtimes and cache files on Linux safely with Kudu.
How to Clean Up Large Journal Logs on Linux
If journal logs are taking too much space, Kudu can help clean them safely and reclaim disk storage.
How to Clean Up /var/tmp on Linux
Remove unnecessary files from /var/tmp on Linux and reclaim disk space with Kudu.