These 7 Fedora cleanup commands freed up more space than I expected


Fedora is known for its cutting-edge software, stability, and clean implementation of upstream technologies, but even it can accumulate digital clutter over time.

You might start with a 40 GB root partition feeling spacious, only to find it creeping toward 90% usage months later. The culprit isn’t a single large file but thousands of small, unnecessary pieces of data left behind by updates, installations, and normal system operations.

Fortunately, Fedora provides powerful command-line tools to reclaim that space quickly and safely. You don’t need third-party cleaner apps or GUI-based disk analyzers (though those have their place). With a handful of terminal commands, you can strip away the junk while keeping your system fully functional and stable.

Whether you are running Fedora Workstation on a laptop with a small SSD, hosting services on Fedora Server, or maintaining multiple machines, these 7 commands belong in your toolkit. Let’s open a terminal and start cleaning:

Clear the dnf cache

Remove stored package data safely

Start with:

sudo dnf clean all
Screenshot of sudo dnf clean all being using on a fedora system

Dnf keeps a local cache of downloaded packages and repository metadata in /var/cache/dnf. This speeds up installs and updates, but over time it builds up.

If you update frequently, this cache can easily reach hundreds of MBs or more and most of them are non-critical. Running this command removes everything in that cache. The next time you install or update packages, Fedora will simply download fresh copies.

There is a small trade-off in the form of a slightly slower next update but noticeably more free space now (a reasonable exchange unless you are on extremely limited bandwidth).

Remove orphaned packages

Clean unused dependencies automatically

Next:

sudo dnf autoremove
Screenshot of sudo dnf autoremove being run on a fedora system

When you install software, DNF pulls in dependencies automatically: libraries, helper tools, runtime components. When you remove the original package, those dependencies often stay behind.

Over time, these accumulate into what are effectively unused packages. autoremove cleans them up. It removes only packages that are no longer required by anything else, so it is relatively safe.

If you want to preview what will be removed:

sudo dnf repoquery --unneeded

This gives you visibility before making changes. It is useful if you are cautious or just curious about what has been lingering in your system.

Trim system logs

Limit journal size effectively

System logs are useful, but they are not meant to grow indefinitely.

Run:

sudo journalctl --vacuum-size=200M
screenshot of sudo journalctl --vacuum-size=200M being run on a fedora system

This limits your logs to 200 MB, deleting older entries automatically. Alternatively, you can keep logs by time:

sudo journalctl --vacuum-time=2d

This keeps only the last two days. Without this, logs can grow into GBs over time, especially on systems with frequent activity or debugging enabled.

Server data on a monitor with Database MySQL.


5 Great Linux Utilities to Monitor Your System Resources in the Terminal

Because the core utilities don’t do it all.

Empty the trash

Delete hidden recycled files permanently

If you delete files through a file manager, they are not actually deleted. They are moved to:

~/.local/share/Trash/

To clear it:

rm -rf ~/.local/share/Trash/*

This is safe for your user account, but it is permanent. There is no undo. It is also one of the easiest ways to reclaim space quickly, especially if you tend to “delete” large files without emptying the trash afterward (which is more common than most people admit).

Clean /var/tmp

Remove persistent temporary system files

Fedora uses two temporary directories: /tmp/ and /var/tmp. The /tmp directory is designed for short-lived temporary files that don’t need to survive a system restart. Most Fedora configurations clear /tmp automatically during boot, either fully or by removing files older than a certain age, making it ideal for session-specific data like browser caches or application scratch space.

Whereas, /var/tmp preserves its contents across reboots, serving as a location for temporary files that need to persist longer, such as interrupted download fragments, package manager leftovers from incomplete installations, or long-running process data that should survive a system crash or intentional reboot.

side by side comparison of contents of /tmp and /var/tmp directories on fedora

The second one is where things quietly pile up. Clean it with:

sudo rm -rf /var/tmp/*

This removes leftover temporary files from installers, scripts, and processes that never cleaned up after themselves. It is generally safe, but avoid running it while major installations or updates are in progress (timing matters here).

Clear old user cache files

Remove stale cache data safely

User-level caches can become surprisingly large. Browsers, package managers, and desktop environments all store data in:

~/.cache

Instead of deleting everything blindly, remove only older, unused files:

find ~/.cache -type f -atime +30 -delete

This deletes files not accessed in the last 30 days. It is a balanced approach as you keep active cache files for performance, while removing stale ones that serve no purpose.

An external hard drive with linux and ShredOS logos connect to a laptop and an eraser beside.


ShredOS: How to Securely Wipe a Hard Drive With Linux

Getting rid of your old PC? Make sure you wipe it clean to protect yourself.

Remove old kernels

Free space but proceed carefully

Fedora keeps multiple kernel versions as a safety measure. If a new kernel fails, you can boot into an older one. That is a good default, but each kernel takes space. Typically, 200 to 400 MB once you include modules and initramfs.

To clean up old kernels:

sudo package-cleanup --oldkernels --count=2

This keeps the current kernel and one previous version, removing everything else. If the command is missing:

sudo dnf install yum-utils

Do not manually delete files from /boot. Kernel management is one of those areas where precision matters more than confidence (and guessing wrong has consequences). I won’t suggest using it on something critical unless you are quite sure about it.

What you should not touch

Avoid breaking critical system areas

Some directories look like cleanup targets but are not.

Avoid these:

/boot manually
~/.config
/var/log directly

These contain critical data, settings, or active logs. Removing files blindly here can break things in subtle or obvious ways. Always use the appropriate tools instead of manual deletion.

How often should you do this

Set a simple maintenance routine

There is no strict schedule, but a good rule is to clean up after major updates or once every few weeks, especially when disk space starts shrinking unexpectedly.

Fedora Linux logo


10 Things You Should Do Right After Installing Fedora Linux

10 tricks to supercharge your new Fedora installation!

Fedora does not require constant maintenance as it is designed to be stable and self-managing for the most part, but no system can automatically remove every stray log file, orphaned dependency, or old kernel that lingers after months of use.


What actually changes after cleanup

After running these commands, the changes are not dramatic in appearance. In fact, there is no clear visual change. What you get instead is more free disk space, cleaner package state, smaller logs and fewer leftover files. The system feels lighter because unnecessary weight has been removed without installing any additional tools.



Source link

Leave a Reply

Subscribe to Our Newsletter

Get our latest articles delivered straight to your inbox. No spam, we promise.

Recent Reviews


Google Maps has a long list of hidden (and sometimes, just underrated) features that help you navigate seamlessly. But I was not a big fan of using Google Maps for walking: that is, until I started using the right set of features that helped me navigate better.

Add layers to your map

See more information on the screen

Layers are an incredibly useful yet underrated feature that can be utilized for all modes of transport. These help add more details to your map beyond the default view, so you can plan your journey better.

To use layers, open your Google Maps app (Android, iPhone). Tap the layer icon on the upper right side (under your profile picture and nearby attractions options). You can switch your map type from default to satellite or terrain, and overlay your map with details, such as traffic, transit, biking, street view (perfect for walking), and 3D (Android)/raised buildings (iPhone) (for buildings). To turn off map details, go back to Layers and tap again on the details you want to disable.

In particular, adding a street view and 3D/raised buildings layer can help you gauge the terrain and get more information about the landscape, so you can avoid tricky paths and discover shortcuts.

Set up Live View

Just hold up your phone

A feature that can help you set out on walks with good navigation is Google Maps’ Live View. This lets you use augmented reality (AR) technology to see real-time navigation: beyond the directions you see on your map, you are able to see directions in your live view through your camera, overlaying instructions with your real view. This feature is very useful for travel and new areas, since it gives you navigational insights for walking that go beyond a 2D map.

To use Live View, search for a location on Google Maps, then tap “Directions.” Once the route appears, tap “Walk,” then tap “Live View” in the navigation options. You will be prompted to point your camera at things like buildings, stores, and signs around you, so Google Maps can analyze your surroundings and give you accurate directions.

Download maps offline

Google Maps without an internet connection

Whether you’re on a hiking trip in a low-connectivity area or want offline maps for your favorite walking destinations, having specific map routes downloaded can be a great help. Google Maps lets you download maps to your device while you’re connected to Wi-Fi or mobile data, and use them when your device is offline.

For Android, open Google Maps and search for a specific place or location. In the placesheet, swipe right, then tap More > Download offline map > Download. For iPhone, search for a location on Google Maps, then, at the bottom of your screen, tap the name or address of the place. Tap More > Download offline map > Download.

After you download an area, use Google Maps as you normally would. If you go offline, your offline maps will guide you to your destination as long as the entire route is within the offline map.

Enable Detailed Voice Guidance

Get better instructions

Voice guidance is a basic yet powerful navigation tool that can come in handy during walks in unfamiliar locations and can be used to ensure your journey is on the right path. To ensure guidance audio is enabled, go to your Google Maps profile (upper right corner), then tap Settings > Navigation > Sound and Voice. Here, tap “Unmute” on “Guidance Audio.”

Apart from this, you can also use Google Assistant to help you along your journey, asking questions about your destination, nearby sights, detours, additional stops, etc. To use this feature on iPhone, map a walking route to a destination, then tap the mic icon in the upper-right corner. For Android, you can also say “Hey Google” after mapping your destination to activate the assistant.

Voice guidance is handy for both new and old places, like when you’re running errands and need to navigate hands-free.

Add multiple stops

Keep your trip going

If you walk regularly to run errands, Google Maps has a simple yet effective feature that can help you plan your route in a better way. With Maps’ multiple stop feature, you can add several stops between your current and final destination to minimize any wasted time and unnecessary detours.

To add multiple stops on Google Maps, search for a destination, then tap “Directions.” Select the walking option, then click the three dots on top (next to “Your Location”), and tap “Edit Stops.” You can now add a stop by searching for it and tapping “Add Stop,” and swap the stops at your convenience. Repeat this process by tapping “Add Stops” until your route is complete, then tap “Start” to begin your journey.

You can add up to ten stops in a single route on both mobile and desktop, and use the journey for multiple modes (walking, driving, and cycling) except public transport and flights. I find this Google Maps feature to be an essential tool for travel to walkable cities, especially when I’m planning a route I am unfamiliar with.


More to discover

A new feature to keep an eye out for, especially if you use Google Maps for walking and cycling, is Google’s Gemini boost, which will allow you to navigate hands-free and get real-time information about your journey. This feature has been rolling out for both Android and iOS users.



Source link