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 /tmp using more space than expected

How to Fix It Manually

  1. Check how much space /tmp is using

    • Open a Terminal.
    • Run:
      sudo du -sh /tmp
    • This shows the total size of the /tmp folder so you can confirm whether it is worth cleaning.
  2. 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.
  3. 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 /tmp that 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
  4. 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.
  5. Clean /tmp during a reboot if needed

    • Many Linux systems clear some or all of /tmp automatically on reboot.
    • Save your work and restart the computer:
      sudo reboot
    • After rebooting, check usage again:
      sudo du -sh /tmp
  6. 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
  7. 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.

Download Kudu Free →

Fix this automatically with Kudu

Run a free system scan to detect and resolve this issue automatically — no manual steps required.

Download Kudu Free →