To clear recent files history in Linux without deleting actual data, you must remove the metadata entries stored in ~/.local/share/recently-used.xbel. This XML-based file tracks your activity for applications like Nautilus and Dolphin. Deleting this specific file or truncating it via command line instantly wipes the "Recent" list from your file manager interface while leaving all original documents intact on your disk.
Understanding the Recent Files Mechanism
Modern Linux desktop environments rely on a standardized protocol called XDG (X Desktop Group) to manage application state. One of these standards is therecently-used specification, which ensures that different applications can share a consistent view of what files you have accessed recently. The primary storage location for this information is typically ~/.local/share/recently-used.xbel.
It is crucial to distinguish between the *history* of file access and the *files* themselves. The history is merely a log—a list of pointers or references to file paths. When you delete this log, you are not removing the underlying data structures, permissions, or contents of your documents. You are simply erasing the record that those documents were opened. This distinction is vital for privacy-conscious users who wish to scrub their activity trails without risking accidental deletion of important work.
For users managing complex workflows, understanding how file managers interact with this database helps prevent confusion. If you are also looking to organize your workspace, you might find it useful to check out our guide on how to Effortlessly Move HTML Files and Folders in Linux, as proper file organization often complements privacy maintenance.
Method 1: Using the Command Line
The most reliable and universal method to clear recent files across any Linux distribution and desktop environment is using the terminal. This approach bypasses potential bugs in graphical user interfaces and ensures the file is completely cleared rather than just hidden. Open your terminal emulator. Navigate to your home directory if you are not already there by typingcd ~. To verify that the file exists and contains data, you can view its size using the ls -lh command on .local/share/recently-used.xbel.
To remove the history, execute the following command:
rm ~/.local/share/recently-used.xbel
This command deletes the XML file entirely. Most modern file managers will automatically regenerate an empty version of this file the next time they launch, ensuring that the system remains stable. If you prefer not to delete the file but instead want to keep an empty structure, you can truncate it using:
truncate -s 0 ~/.local/share/recently-used.xbel
After running either command, close and reopen your file manager. The "Recent" tab should now be empty. Note that some applications may cache this data temporarily; restarting the computer or logging out and back in guarantees that no stale data remains in memory.
Method 2: Clearing History in Specific File Managers
While the command-line method works universally, some users prefer using the graphical interface provided by their desktop environment. However, these menus vary significantly depending on whether you use GNOME, KDE, or XFCE. GNOME Files (Nautilus) In modern versions of GNOME, the interface has shifted away from simple "Clear History" buttons in older locations. Instead, you often need to access the preferences directly. Open Nautilus, click the hamburger menu (three horizontal lines) in the top right, and select Preferences. Look for the Privacy tab. Here, you will find options to disable recording recent items or to clear them immediately. If the button is grayed out, ensure that the toggle for "Show recently used files" is active, as clearing requires the feature to be enabled first. KDE Plasma (Dolphin) Dolphin handles recent files slightly differently. Open Dolphin and go to Settings > Configure Dolphin. Navigate to the General or Behavior section. You may find a checkbox labeled "Remember recently used files." Unchecking this stops future tracking. To clear existing history, you often need to manually delete therecently-used.xbel file as described in Method 1, as Dolphin does not always provide a GUI button to purge the list completely.
XFCE (Thunar)
Thunar is known for its simplicity. Go to Edit > Preferences. Select the Advanced tab. Check the box for "Display the recently modified files in the sidebar." To clear the list, Thunar usually offers a "Clear" button within this dialog. If not, the same command-line deletion of recently-used.xbel applies perfectly here as well.
If you are concerned about security contexts while managing these files, remember that editing system-level configurations often requires care. For broader context on privilege management, you might refer to our article on Run Programs with Elevated Privileges: A Comprehensive Guide, although clearing user history does not require sudo rights.
Preventing Future Tracking
Clearing your history is a reactive measure. To maintain ongoing privacy, consider disabling the feature entirely. In your file manager's preferences, look for settings related to "Recent Items," "History," or "Privacy." Disabling this feature prevents the creation of therecently-used.xbel file altogether, meaning there is nothing to delete later.
Additionally, be aware that other applications beyond file managers track recent files. Text editors, image viewers, and even web browsers may maintain their own separate lists. For instance, Firefox stores recent documents in a separate JSON file within its profile directory. If you need comprehensive cleanup, you must address each application individually.
Some enterprise environments use centralized policies to enforce these settings. If you are on a managed machine, contact your IT administrator before modifying these files, as group policies may overwrite manual changes.
Frequently Asked Questions
Does deleting recently-used.xbel affect my system performance?
No, deleting this file has no negative impact on system performance. The file is small and lightweight. In fact, keeping it indefinitely consumes negligible resources, so removing it does not speed up your computer but does enhance privacy.Will clearing recent files delete the actual photos or documents?
Absolutely not. The recent files list is just a log of file paths. Removing the log removes the reference to the file, but the file itself remains exactly where you saved it. Your data is safe.Why do recent files reappear after I clear them?
This happens because applications continue to run in the background and write new entries to the file. If you open a document after clearing the list, it will immediately appear again. To stop this, you must disable the "Record recently used files" option in your file manager's settings.Can I clear recent files for a single application only?
The standardrecently-used.xbel file is shared across many desktop applications. It is difficult to isolate a single app's history using this file alone. You would need to check the specific configuration folders of individual applications (like LibreOffice or GIMP) for their own separate history logs.
Is there a way to automate this process?
Yes, you can create a cron job or a systemd timer that runs therm or truncate command at regular intervals. This is useful for shared computers where you want to ensure privacy after every session or at set times.