Clear “Recent Items” in Gnome-Shell

When using gnome-shell there isn’t any way to clear your recent items (yet).
There is a way to do it via CLI.

rm ~/.recently-used.xbel
rm ~/.recently-used

After a few second or opening a random file, your recent items are cleared.

Tags: , ,

13 Responses to “Clear “Recent Items” in Gnome-Shell”

  1. Francisco April 27, 2010 at 23:45 #

    It does not work for me.

  2. buntu May 4, 2010 at 00:52 #

    after those commands do
    mkdir /home/user/recently-used.xbel
    only a temporary workaround but it’s being worked on

    • Arjan Jorink May 8, 2010 at 10:25 #

      Thanks for the add on.
      Making this directory should prevent that Ubuntu creates a new list with recent items.

  3. Jason October 10, 2010 at 22:46 #

    If you download the AWN dock bar, there is an applet called main menu. It opens like the gnome 2 menu. From there you click on recent documents scroll to the bottom and click clear recent items.

  4. JFlesh January 18, 2011 at 00:01 #

    Jason’s comment on the “AWN – Cairo Main Menu” works VERY effectively.

    Was worried that I wasn’t gonna be able to use the GnomeShell regularly because of the Recent Items portion.

    It highlighted the part of my life my gf understands but doesn’t really wanna see either. XD

  5. Ergo April 22, 2011 at 23:45 #

    following script when ran will clear the file

    #!/usr/bin/env python
    import os
    home = os.environ.get(‘HOME’)
    bookmark_path = ‘.local/share/recently-used.xbel’
    from xml.etree.ElementTree import ElementTree
    tree = ElementTree()
    root = tree.parse(os.path.join(home,bookmark_path))
    root.clear()
    tree.write(os.path.join(home,bookmark_path),encoding=”utf8″)
    print “cleared your bookmarks”

  6. Rhynox July 17, 2011 at 10:44 #

    delete recently-used.xbel (usually found in ~/.local/share/)
    right click & create new file & rename to ‘recently-used.xbel’
    right click & goto properties of that file,goto permission tab,change Access from ‘Read and write’ to ‘Read-Only’ close the properties window.

  7. Phil July 30, 2011 at 19:36 #

    More elegantly (in my opinion):

    cat /dev/null > ~/.local/share/recently-used.xbel

  8. Manuel August 19, 2011 at 15:46 #

    hey… the python script does not work…

    #!/usr/bin/env python
    import os
    home = os.environ.get(‘HOME’)
    bookmark_path = ‘.local/share/recently-used.xbel’
    from xml.etree.ElementTree import ElementTree
    tree = ElementTree()
    root = tree.parse(os.path.join(home,bookmark_path))
    root.clear()
    tree.write(os.path.join(home,bookmark_path),encoding=”utf8″)
    print “cleared your bookmarks”

    Traceback (most recent call last):
    File “./clearrecent.py”, line 8, in
    root = tree.parse(os.path.join(home,bookmark_path))
    File “/usr/lib64/python2.7/xml/etree/ElementTree.py”, line 653, in parse
    parser.feed(data)
    File “/usr/lib64/python2.7/xml/etree/ElementTree.py”, line 1624, in feed
    self._raiseerror(v)
    File “/usr/lib64/python2.7/xml/etree/ElementTree.py”, line 1488, in _raiseerror
    raise err
    xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 0

  9. john September 18, 2011 at 09:30 #

    Command line

    echo “” > local/share/recently-used.xbel

  10. Tom October 19, 2011 at 19:40 #

    Here’s a better way:

    1. Open the looking glass by pressing Alt+F2 and then typing lg

    2. Enter “imports.gi.Gtk.RecentManager.get_default().purge_items()”

    Of course, it would be trivial to write a gnome shell extension that integrates this in some menu.

  11. Kyle December 2, 2011 at 04:54 #

    +1 for Phil’s comment. Much cleaner

    Phil posted:
    More elegantly (in my opinion):
    cat /dev/null > ~/.local/share/recently-used.xbel

  12. Rob December 15, 2011 at 20:48 #

    *even” More elegantly (in my opinion) i.e. permanent fix:
    rm ~/.local/share/recently-used.xbel
    mkdir ~/.local/share/recently-used.xbel (stops the file being created / repopulated as it’s now a folder!

Leave a Reply