To clean up disk space on Arch Linux, first identify which filesystem is full, then remove reclaimable data such as old Pacman package archives, excess journal logs, unused packages, or application caches. Start by checking disk usage and inspecting large directories; do not manually erase files under /usr or /var/lib/pacman.
Find out what is using the space
Before deleting anything, find out whether the problem is a full disk, a full partition, or a shortage of file-system inodes. These are different issues and call for different fixes. Run:
df -hTto see available space, usage, and filesystem types for mounted filesystems.df -ito check inode usage. A filesystem can run out of inodes even when it has bytes free, usually because it contains a very large number of small files.sudo du -xhd1 / 2>/dev/null | sort -hto compare the sizes of top-level directories on the root filesystem.
The -x option keeps du on one filesystem, which helps avoid counting a separate mounted drive as part of the root disk. If a large directory stands out, inspect its subdirectories rather than deleting it wholesale. A disk-usage viewer such as ncdu can make this exploration easier; install it with sudo pacman -S ncdu if it is not already available.
Remember that df and du answer slightly different questions. df reports space used by the filesystem, while du totals files it can see. Open-but-deleted files can make the numbers differ until the program holding them open exits. On filesystems with snapshots or special allocation features, a normal directory-size report may also fail to show what is retaining space.
Clean the Pacman package cache
Pacman stores downloaded package archives in /var/cache/pacman/pkg. Keeping these files can be useful: if an update causes trouble, a cached older package may help with a manual rollback, and reinstalling a package may not require downloading it again. The trade-off is that archives accumulate, especially on a rolling-release system.
Use Pacman’s built-in cache cleanup command to remove cached packages that are not currently installed:
sudo pacman -Sc
Read the prompt before confirming. This is a reasonable first cleanup for many users, but it can remove older package versions that would otherwise be available locally. The more aggressive sudo pacman -Scc clears the entire package cache, including archives for installed packages. It can recover more space, but after that you may need an internet connection to reinstall or downgrade packages. It does not uninstall the packages currently on your system.
For more control, install pacman-contrib and use its paccache utility. For example, sudo paccache -r removes older cached versions while retaining the three most recent cached versions of each package by default. Keeping fewer versions saves more space; keeping more gives you more local recovery options. If you rely on cached packages for recovery, check the tool’s options and consider copying important archives to another disk before pruning.
Remove unused packages carefully
Packages installed as dependencies can remain after the package that needed them has been removed. Pacman can list packages that are no longer required as dependencies with:
pacman -Qdtq
Review the results before removing anything. A package can be technically orphaned but still useful to you, and a package you installed for a specific task may not be obvious from its name. If the list is nonempty and you have checked it, remove selected packages with sudo pacman -Rns package_name, replacing package_name with the package you intend to remove. The -s option also removes dependencies that are no longer needed, while -n avoids saving package configuration files as backup files.
Avoid copying a bulk-removal command from a post without checking what it will do. In particular, do not remove packages just because they are large: a kernel, compiler, or library may be essential to your setup or needed by software you use. Pacman presents a transaction summary before proceeding; read it and cancel if the proposed removals are unexpected.
Reduce system journal and log usage
Systemd’s journal can grow over time. Check its current size with journalctl --disk-usage. To remove archived journal data until the total is around 500 MB, run:
sudo journalctl --vacuum-size=500M
You can also remove archived entries older than a chosen period, for example sudo journalctl --vacuum-time=14d. Vacuuming removes archived journal files; it does not necessarily shrink the active journal immediately. Choose a limit that leaves enough history to troubleshoot problems rather than treating all logs as disposable.
Other logs may be managed by logrotate or by the application that created them. Inspect large files under /var/log and look for a cause, such as repeated errors filling a log. Do not delete a log file that a running service is actively writing to as a first response: the process may keep writing to the deleted file, so disk space may not return until it closes the file or restarts. Prefer fixing the source of excessive logging and using the relevant rotation or service tools.
Check user caches and application data
Applications often store rebuildable data under ~/.cache, but not everything in a home directory is disposable. Browser caches, image thumbnails, and some application caches may be regenerated; mail stores, game saves, virtual-machine disks, and project files generally cannot. Inspect sizes first with a command such as du -h --max-depth=1 ~/.cache | sort -h, then close the relevant applications before removing a specific cache directory.
Be cautious with blanket commands such as deleting every hidden directory in your home folder. Hidden folders can contain configuration, credentials, databases, and user data, not just temporary files. If you use an AUR helper, its build directory may also take space, but check the helper’s own cache-management options and confirm which files are build artifacts before clearing them. A clean rebuild may require downloading sources and compiling packages again.
Look for snapshots, containers, and large files
On systems configured with Btrfs snapshots, deleting a visible file may not free its blocks while a snapshot still references them. Check which snapshot tool you use, such as Snapper or Timeshift, and remove old snapshots through that tool rather than deleting snapshot directories by hand. Btrfs users can inspect allocation with sudo btrfs filesystem usage -T /. Snapshot retention is a balance: fewer snapshots reclaim more space but leave fewer restore points.
Development tools can also retain substantial data. Docker images, stopped containers, and build caches are not managed by Pacman. Inspect them with Docker’s reporting commands before pruning; commands such as docker system prune can remove resources you still expect to use, and adding options to remove unused images is more destructive. Likewise, check virtual-machine images, downloaded ISO files, game libraries, and old backups as ordinary user data. Move or delete them only after confirming they are no longer needed and that any important data is backed up.
What not to delete manually
Arch does not require routine manual deletion of files from package-managed system directories. Do not remove arbitrary files from /usr, /lib, or /var/lib/pacman to save space. Pacman tracks installed package files and database state; manually removing them can leave broken software or a confusing mismatch between installed packages and files on disk. Use Pacman to remove packages, and use the application’s documented method for its data.
Also avoid treating every large file as junk. A core dump may be useful when diagnosing a crash, a package cache may be useful for recovery, and a snapshot may be the only convenient way to restore a working system. Before deleting, ask whether the item is reproducible, whether you have another copy, and whether it belongs to a running service. If the answer is unclear, investigate first.
A practical cleanup order
For a routine cleanup, work from low-risk checks toward more consequential changes. This keeps the process understandable and makes it easier to identify what actually recovered space:
- Run
df -hTand identify the full filesystem. - Use
duorncduto locate large directories on that filesystem. - Review and clean the Pacman cache with
pacman -Scor a configuredpaccachepolicy. - Check journal usage and set a reasonable vacuum limit if logs are unusually large.
- Review orphaned packages and application caches, removing only items you recognize.
- Inspect snapshots, container storage, and personal files if the space is still missing.
After cleanup, run df -hT again and compare the result. If reported usage barely changes after deleting a large file, check whether a process still has it open or whether snapshots retain it. If a filesystem fills again quickly, look for a recurring log, cache, download, or application process instead of repeating broad deletion commands.
Frequently Asked Questions
How do I clear the Pacman cache on Arch Linux?
Run sudo pacman -Sc to remove cached packages that are not currently installed, or use paccache -r from pacman-contrib to retain a chosen number of recent versions. Use pacman -Scc only if you deliberately want to clear the whole cache.
Is it safe to delete everything in /var/cache/pacman/pkg?
It will not normally uninstall installed packages, but it removes local package archives that could help with reinstalling or downgrading. Prefer Pacman’s cleanup tools so you understand what is being removed and can choose how much rollback history to keep.
Why is disk space still full after I deleted a large file?
A running process may still have the deleted file open, or a filesystem snapshot may retain its data. Check the filesystem again, investigate open files and snapshot usage, and use the relevant service or snapshot tools to release space safely.
Can I delete files in /var/log or /usr?
Do not remove files from /usr by hand; use Pacman to manage installed software. For logs, identify which file is large and manage it with the service or log rotation setup rather than deleting an actively written file blindly.
Does Arch Linux need a disk-cleaning application?
No special cleaner is required. Standard tools such as df, du, Pacman, paccache, and journalctl cover common cases. A visual tool can help find large directories, but it cannot decide which personal files or recovery data are safe to remove.