Sometimes others in my household briefly use my computer, when they do I sometimes don't want them to see my file history. I know how to prevent Bash from writing entries to the ~/.bash_history file temporarily. How can I wipe the history that is shown in the menu, for instance with files viewed in eog?

Can you quickly clear the recent history from the shell. That is without using the cumbersome and clearly visible path by going to the menu, clicking Recent Files, scrolling past all the names that I want to remove and then click Clear List?

2 Answers 2


The history is in ~/.local/share/recently-used.xbel but it is not sufficient to remove that file. If you do the Recent Files entry keeps on showing the files you accessed, and if you open a file with an application that creates an Recent Files entry, that and the old list of files will be written to that file again.

What you want to do is make an alias or script that removes the file and then touches it to be empty:

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

or do:

echo -n '' > ~/.local/share/recently-used.xbel

If you want to be less conspicuous you can also edit the file and delete any entries you don't want in history. It is an XML file with <bookmark> entries that have an href attribute that contains the URI to the content.

You can e.g. use xmlstarlet the following to remove any entries you clicked on your desktop for which the filename starts with food:

xmlstarlet ed -L -d "/xbel/bookmark[starts-with(@href, 'file:///home/$USER/Desktop/food')]" ~/.local/share/recently-used.xbel

Run this, to create a boiler plate xbookmark/xml file in that location ~/.local/share/recently-used.xbel.

cat > ~/.local/share/recently-used.xbel <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<xbel version="1.0"

Then run sudo chattr +i ~/.local/share/recently-used.xbel so it can never be modified without root.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .