Ubuntu clear recently used files

In Unity, the recent documents that you see in the Files lens are logged using Zeitgeist.

$ rm ~/.local/share/zeitgeist/activity.sqlite
$ zeitgeist-daemon --replace

DISABLING ALL LOGGING. Copy these three lines to a blank text file:

CREATE TRIGGER IF NOT EXISTS no_logging_uri AFTER INSERT ON uri BEGIN DELETE FROM uri ; END;
CREATE TRIGGER IF NOT EXISTS no_logging_event AFTER INSERT ON event BEGIN DELETE FROM event ; END;
CREATE TRIGGER IF NOT EXISTS no_logging_text AFTER INSERT ON text BEGIN DELETE FROM text ; END;

Let’s suppose you named the file as triggers.sql. The next thing to do is apply these triggers on the activity database:

$ cat triggers.sql | sqlite3 ~/.local/share/zeitgeist/activity.sqlite

If you want to restore the standard functionality simply remove the database (it will be recreated without the triggers):

$ rm ~/.local/share/zeitgeist/activity.sqlite

The Classic desktop (and the lists of recently used files in most applications’ File menus) stores a record of your recently used documents in ~/.local/share/recently-used.xbel. You can just delete this file using the file manager or copy and paste the following code into a terminal:

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

To DISABLE this feature, RUN this command on your Terminal:

$ touch ~/.local/share/recently-used.xbel
# Then, make the file immutable:
$ chattr +i ~/.local/share/recently-used.xbel