Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to permanently prevent Ubuntu 12.10 from creating a "recently used" file list. This list seems to be stored in the file:

/home/user/.local/share/recently-used.xbel

I have tried deleting this file, but it keeps being recreated every time I start a new login session. I need to know how to prevent this file from being recreated.

share|improve this question
    
I'd love to see this solved too. –  invert Jun 1 '13 at 19:42
    
Can someone file a bug on bugzilla.gnome.org? –  int_ua Apr 18 at 16:21

3 Answers 3

To disable the list for GTK 3 based applications follow these steps:

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

If THERE ISN'T a "~/.config/gtk-3.0/settings.ini", then

mkdir -p ~/.config/gtk-3.0
    echo -e "[Settings]\ngtk-recent-files-max-age=0\ngtk-recent-files-limit=0" > ~/.config/gtk-3.0/settings.ini

If THERE IS a "~/.config/gtk-3.0/settings.ini", then

echo -e "\ngtk-recent-files-max-age=0\ngtk-recent-files-limit=0" >> ~/.config/gtk-3.0/settings.ini

(note the ">>" vs the ">" difference ; ">>" appends to a file while a single ">" completely overwrites it, without backup, if it already exists)

And in either case:

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

To disable the list for GTK 2 based applications follow this step:

echo gtk-recent-files-max-age=0 >> ~/.gtkrc-2.0

These steps are better than changing permissions on the file as they prevent error messages from being shown when launching GTK based applications that rely on the file.

Detailed information can be found here - https://alexcabal.com/disabling-gnomes-recently-used-file-list-the-better-way/

share|improve this answer
    
It will be nice if you include the actual codes for gtk2 and gtk3 in your answer. People can then look at the link for background if they want. It would be helpful in case the link is inaccessible –  user25656 Mar 19 '13 at 10:30
    
@vasa1 Good idea will do so shortly. –  kingmilo Mar 19 '13 at 10:32
    
I'm trying out the settings.ini and gtkrc-2.0 mods :) I won't go the script route. –  user25656 Mar 19 '13 at 10:36
1  
Okay, I made the changes, deleted all the bookmarks from recently-used.xbel and logged in again. I created a few files. Looking good so far. Although it looks like some programs may have their own internal "recently used" lists. LibreOffice Calc seems to be one of them. –  user25656 Mar 19 '13 at 10:47
1  
One last point :) Someone could still find out what has been accessed. See this code for example: find ~/{Documents,Desktop,Downloads,Music} -ctime -1 -type f -exec bash -c 'select f;do [[ -n $f ]]&&xdg-open "$f"||exit;done' _ '{}' +. It's based on suggestions by schragge in this thread and doesn't rely on recently-used.xbel. Bottom line: if someone else has access to the PC, "ordinary" measures won't be enough. –  user25656 Mar 19 '13 at 11:02

Assuming it's only that file that you want to prevent from being written, you could try changing its permissions so it cannot be accessed.

First, delete the file. Then, create a new, blank one. Then, customize its permissions.

cd ~/.local/share
rm recently-used.xbel
touch recently-used.xbel
chmod 000 recently-used.xbel

If you want, you can even change its ownership so no program running as your user can change its permissions and write to it:

sudo chown root:root recently-used.xbel

Some programs might issue errors (with or without that final customization).

share|improve this answer
    
Any idea which program(s) write to that file? –  user25656 Mar 19 '13 at 10:05
    
I see this file (xml) in Lubuntu which does not have Zeitgeist, AFAIK. –  user25656 Mar 19 '13 at 10:08
    
I get just the prompt returned. Yes, mine is a pure Lubuntu install. –  user25656 Mar 19 '13 at 10:15
1  
@vasa1 GTK based applications write to that file. –  kingmilo Mar 19 '13 at 10:16
    
GTK programs do issue an error to stderr if this file is chmod to root, remarkably the file gets recreated as the user as owner. How mysterious! This solution does not seem to work. –  invert Jun 1 '13 at 19:39

So far this file gets recreated even if you chown it to root or make it immutable. Even if you set the max-age settings to 0, it still remembers directories.

I have implemented a workaround that clears this file every 5 minutes. It's a very nasty workaround: create a cron entry that clears the file frequently:

crontab -e

# clear gtk recently used list every 5 minutes
*/5 *   *   *   *   echo "" > .local/share/recently-used.xbel

Certain applications still default to the recently used list, but this satisfies your question to permanently prevent Ubuntu 12.10 from creating a "recently used" file list.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.