← All commands
Topic hub System & Storage
Windows Linux System & Storage Expanded guide System

Windows cleanmgr (Disk Cleanup) equivalent in Linux

Removes temporary files, old package caches, and other items that can safely be deleted to recover disk space.

Windows cleanmgr (Disk Cleanup)
→
Linux equivalents
Debian/Ubuntu apt
sudo apt clean && sudo apt autoremove
Fedora dnf
sudo dnf clean all && sudo dnf autoremove
Arch pacman
sudo pacman -Sc

Overview

What this command does

On Windows, "cleanmgr (Disk Cleanup)" is used to free up disk space. On Linux, the closest practical mapping shown here is "sudo journalctl --vacuum-size=200M". Removes temporary files, old package caches, and other items that can safely be deleted to recover disk space. This reference is grouped under System & Storage → System.

Migration tip: <code>ncdu</code> is useful for finding large directories before deleting anything. Install it with your distribution package manager, then run <code>sudo ncdu /</code>.

Windows → Linux context

What changes when you use this on Linux?

Equivalent task, different tool

Windows cleanmgr (Disk Cleanup) maps to package cache cleanup / journalctl vacuum for this task. Treat this as a workflow mapping rather than a character-for-character syntax translation.

Distribution details matter

The Debian/Ubuntu, Fedora and Arch rows are not identical. Use the row for your distribution instead of changing only the package-manager name in an example.

Elevated privilege appears in this workflow

At least one example uses sudo. Confirm the target path, device, service or package before running the elevated form; do not add sudo simply to bypass an unexplained permission error.

Command-specific caution

Package-cache cleanup commands differ by distribution. Review the package manager prompt before confirming, and inspect disk usage before deleting unfamiliar files.

Practical tasks

Common use cases

Free up disk space

Removes temporary files, old package caches, and other items that can safely be deleted to recover disk space.

sudo apt clean && sudo apt autoremove

Debian/Ubuntu: clear downloaded packages and remove unused dependencies

sudo dnf clean all && sudo dnf autoremove

Fedora: clear cached metadata/packages and remove unused dependencies

sudo pacman -Sc

Arch: remove packages that are no longer installed from the package cache

Ready to run

Copyable Linux commands

Review paths, device names, package names and permissions before running any command.

sudo apt clean
sudo apt autoremove
sudo dnf clean all
sudo dnf autoremove
sudo pacman -Sc
sudo journalctl --vacuum-size=200M

Walkthrough

Examples with explanations

# Debian/Ubuntu package cache and unused dependencies:
sudo apt clean
sudo apt autoremove

# Fedora package cache and unused dependencies:
sudo dnf clean all
sudo dnf autoremove

# Arch package cache (review the prompt before confirming):
sudo pacman -Sc

# Any systemd-based distribution: limit journal size:
sudo journalctl --vacuum-size=200M

Reference

Common options and variations

Command or optionUse
sudo apt clean && sudo apt autoremoveDebian/Ubuntu: clear downloaded packages and remove unused dependencies
sudo dnf clean all && sudo dnf autoremoveFedora: clear cached metadata/packages and remove unused dependencies
sudo pacman -ScArch: remove packages that are no longer installed from the package cache
sudo journalctl --vacuum-size=200MAll three distributions: trim the systemd journal to approximately 200 MB
sudo ncdu /Interactively inspect disk usage before cleaning

Distro differences

Debian/Ubuntu vs Fedora vs Arch

The equivalent is distribution-specific for this task: Debian/Ubuntu uses "sudo apt clean && sudo apt autoremove"; Fedora uses "sudo dnf clean all && sudo dnf autoremove"; Arch uses "sudo pacman -Sc".

DistributionPackage manager / baseEquivalent commandDifference to notice
Debian/Ubuntu apt sudo apt clean && sudo apt autoremove APT separates cache cleanup from removal of unused dependency packages.
Fedora dnf sudo dnf clean all && sudo dnf autoremove DNF can clear cached metadata/packages and remove dependencies no longer required.
Arch pacman sudo pacman -Sc Removes cached packages that are no longer installed; review the confirmation prompt.

Important

What to watch out for

Package-cache cleanup commands differ by distribution. Review the package manager prompt before confirming, and inspect disk usage before deleting unfamiliar files.

Keep learning

Related System & Storage commands