Automatically Clear Recent Documents History: A Step-by-Step Guide

Keep It Private: Automatically Clear Recent Documents History Every Time

What this covers

  • Why clearing recent documents history matters for privacy and shared devices.
  • How to set up automatic clearing on Windows and macOS (built-in settings and simple scripts).
  • Options for Linux (GUI and command-line).
  • Scheduling methods: Task Scheduler (Windows), Automator/launchd (macOS), cron/systemd timers (Linux).
  • Quick scripts you can copy-paste for common setups.
  • Testing and verifying the purge works reliably.

Quick summary (action-first)

  1. Windows: Use Group Policy or Scheduled Task to run a PowerShell script that clears the Recent folder and shell MRU registry entries.
  2. macOS: Use a launchd job to run a shell script that clears the Finder recent items and the ~/Library/Application Support/com.apple.sharedfilelist files.
  3. Linux: Add a cron job that removes ~/.local/share/recently-used.xbel or uses desktop-environment tools to clear history.
  4. Verify: After running, open apps and check “Recent” menus; inspect folders/files referenced to ensure entries are gone.

Sample scripts

  • Windows (PowerShell) — clears Recent folder and common MRU registry keys:

powershell

\(recent</span><span> = </span><span class="token" style="color: rgb(163, 21, 21);">"</span><span class="token" style="color: rgb(54, 172, 170);">\)env:APPDATA\Microsoft\Windows\Recent” Remove-Item -Path \(recent</span><span class="token" style="color: rgb(163, 21, 21);">\*"</span><span> </span><span class="token" style="color: rgb(57, 58, 52);">-</span><span>Force </span><span class="token" style="color: rgb(57, 58, 52);">-</span><span>Recurse </span><span class="token" style="color: rgb(57, 58, 52);">-</span><span>ErrorAction SilentlyContinue </span><span></span><span class="token" style="color: rgb(0, 128, 0); font-style: italic;"># Clear common MRU registry locations</span><span> </span><span></span><span class="token" style="color: rgb(54, 172, 170);">\)keys = @( ‘HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU’, ‘HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU’ ) foreach (\(k</span><span> in </span><span class="token" style="color: rgb(54, 172, 170);">\)keys) { if (Test-Path \(k</span><span class="token" style="color: rgb(57, 58, 52);">)</span><span> </span><span class="token" style="color: rgb(57, 58, 52);">{</span><span> </span><span class="token" style="color: rgb(57, 58, 52);">Remove-ItemProperty</span><span> </span><span class="token" style="color: rgb(57, 58, 52);">-</span><span>Path </span><span class="token" style="color: rgb(54, 172, 170);">\)k -Name * -ErrorAction SilentlyContinue } }
  • macOS (bash) — clears Finder recent items and shared file lists:

bash

rm -f ~/Library/Application</span> Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.RecentDocuments.sfl2 killall Finder
  • Linux (bash) — removes GNOME recent file list:

bash

rm -f ~/.local/share/recently-used.xbel

Scheduling examples

  • Windows: Create a Scheduled Task to run the PowerShell script at logout or daily.
  • macOS: Create a LaunchDaemon/LaunchAgent plist to run the script at logout/login intervals.
  • Linux: Add a cron job: 0 * * * * /home/user/scripts/clear_recent.sh to run hourly.

Safety and notes

  • Back up anything important before deleting system files.
  • Some apps keep their own recent lists; you may need app-specific commands or preferences.
  • Deleting MRU registry values can affect autocomplete in dialogs; clear only what you intend.

If you want, I can generate ready-to-install Scheduled Task and launchd plist files tailored to your OS and schedule.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *