The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

If you can read me, I'm broken!

Views: 4,655β€…    Votes:  4β€…
Tags: 18.04   gnome   gedit  
Link: πŸ” See Original Answer on Ask Ubuntu ⧉ πŸ”—

URL: https://askubuntu.com/q/1128496
Title: How to clear history in Gedit? (Ubuntu 18.04)
ID: /2019/03/25/How-to-clear-history-in-Gedit_-_Ubuntu-18.04_
Created: March 25, 2019    Edited:  July 1, 2019
Upload: April 8, 2024    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


Permanent method to always set number of entries

I’m revising my answer with a variation of this GUI answer for command line users.

Use this command to get current number of entries:

$ gsettings get org.gnome.gedit.preferences.ui max-recents

uint32 5

I want to change to 10 so I’ll use this command:

$ gsettings set org.gnome.gedit.preferences.ui max-recents 10

$ gsettings get org.gnome.gedit.preferences.ui max-recents

uint32 10

If you permanently want to have zero saved recent files change 10 to 0. Notice how the get command is repeated after the set command to ensure it β€œsticks”.

Manual method to remove entries

The gedit most recent files list are stored in USER_DIR/.local/share/recently-used.xbel.

Root User

$ sudo cat /root/.local/share/recently-used.xbel
<?xml version="1.0" encoding="UTF-8"?>
<xbel version="1.0"
      xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks"
      xmlns:mime="http://www.freedesktop.org/standards/shared-mime-info"
>
  <bookmark href="file:///etc/default/grub" added="2018-08-03T19:25:50Z" modified="2018-12-27T17:03:38Z" visited="2018-08-03T19:25:51Z">
    <info>
      <metadata owner="http://freedesktop.org">
        <mime:mime-type type="text/plain"/>
        <bookmark:groups>
          <bookmark:group>gedit</bookmark:group>
        </bookmark:groups>
        <bookmark:applications>
          <bookmark:application name="gedit" exec="&apos;gedit %u&apos;" modified="2018-12-27T17:03:38Z" count="41"/>
        </bookmark:applications>
      </metadata>
    </info>
  </bookmark>

Normal User

$ cat ~/.local/share/recently-used.xbel
<?xml version="1.0" encoding="UTF-8"?>
<xbel version="1.0"
      xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks"
      xmlns:mime="http://www.freedesktop.org/standards/shared-mime-info"
>
  <bookmark href="file:///home/rick/.conkyrc" added="2019-03-15T10:57:55Z" modified="2019-03-23T19:04:43Z" visited="2019-03-15T10:57:55Z">
    <info>
      <metadata owner="http://freedesktop.org">
        <mime:mime-type type="text/plain"/>
        <bookmark:groups>
          <bookmark:group>gedit</bookmark:group>
        </bookmark:groups>
        <bookmark:applications>
          <bookmark:application name="gedit" exec="&apos;gedit %u&apos;" modified="2019-03-23T19:04:43Z" count="50"/>
        </bookmark:applications>
      </metadata>
    </info>
  </bookmark>

When removing a gedit entry delete all lines from <bookmark href...> to </bookmark> inclusive.

NOTE: Other applications store entries in this file, not just gedit.

⇧ How to disable sleep / suspend / hibernate HP keyboard buttons for Ubuntu 18.04? How to standby a monitor using xset in multi monitor setup?  β‡©