43

How does one refresh thumbnails in nautilus? In my videos folder I have some MKVs and only half of them have the movie border and a excerpt from the movie and the others (also MKVs encoded in the same way) just have the ordinary film icon.

(F5 doesnt do it.)

3
40

Updated for 14.04 LTS (or later)

From 12.10 onward, thumbnails are stored at ~/.cache/thumbnails

Corrected commands:

rm -r ~/.cache/thumbnails

Then either restart, or:

killall nautilus

Original answer: (for 12.04, and earlier)

Here the commands:

rm -r  ~/.thumbnails
killall nautilus
1
  • 2
    "do do not need to killall nautilus... after running rm -R ~/.thumbnails/fail simply pressing F5 while the desired nautilus window is active to force a reload.. otherwise it will reload next time you access said folder..." PrimeFalcon said this... I think you should include this in your answer – Abraham Murciano Benzadon Jul 7 '17 at 15:11
17

easier way just delete the failed to cache icons by deleting the following directory.

It will make nautilus to refresh only those thumbnails which currently have folder like thumbnail. It will not help if you want to refresh for file/folder which currently have any thumbnail.

Most of the time you should delete this then deleting all the thumbnails.

~/.thumbnails/fail

4
  • Check out this answer for an updated version. – Big McLargeHuge Jun 6 '15 at 23:47
  • 8
    the new path (ubuntu 14.04 LTS or later) is ~/.cache/thumbnails/fail. So just do: rm -r ~/.cache/thumbnails/fail – iuridiniz Nov 14 '16 at 23:06
  • To avoid having to do this repeatedly see this answer. – Elder Geek Apr 19 '19 at 12:14
  • I made a util that rolls up all of this logics. See below :) – meawoppl Jan 5 '20 at 18:42
10

There is a hidden directory in your home called .thumbnails.

If you delete a file (or all) there, its thumbnail will be recreated by nautilus the next time that you visit the dir where it's stored.

I don't know if there is some more convenient way.

Edit: Nautilus will store the thumbnails in memory. You will need to close and start again Nautilus to force it to recreate them.

0
7

Easily force reloading the thumbnails by simply touching the file(s).

touch *

Make sure you cd to the folder first.
If you want more control on what you touch (eheh), just update the glob to taste, e.g. *.mkv.
No need to put your hands in automated configuration folders.

The problem often happens because the thumbnail manager is called as soon as the file is created, often fast enough that it is not completed yet. When creating (encoding videos, creating plots, merging documents, etc.) large files, the thumbnail manager may (try to) create the thumbnail (and fail) before the file is complete.
The command touch updates the 'last edit' time. The thumbnail manager finds the thumbnail to be obsolete (you 'edited' the file since it was last taken) and updates it.

EXTRA: if you happen to need more control on the files (e.g. include subfolders, file patterns, etc.), you can use something like this:

find . -name '*finished*.mkv' | while read f; do touch "$f"; done
5
  • Don't parse the output of ls! You could also easily use shell globbing here: touch *. – David Foerster Jul 5 '16 at 12:51
  • Good point @DavidFoerster! I'm often defaulting to the "while read" parsing even when the extra control is not needed. I'm updating the answer straight away! Thanks! – Giuse Jul 5 '16 at 13:33
  • Your updated command will still misbehave on certain unusual filenames, e.g. those containing newlines, or having leading or trailing spaces. If it's really important to you to use find, then one option is find . -name '*finished*.mkv' -exec touch '{}' ';'. – ruakh Aug 19 '19 at 7:48
  • Did you test this? Can anyone confirm? Because what I see is that in both cases we quote our argument, so I do not expect any problem nor difference. That said, in the years since I posted this answer I found myself rather using find's -exec option too for these tasks, but only for simplicity. Also <bad-joke> if you add newlines in your file names you deserve the error </bad-joke> :) – Giuse Aug 20 '19 at 9:23
  • Seems to work just fine for me; Ubuntu 20.04 – MarsAndBack Apr 2 at 13:30
5

do do not need to killall nautilus... after running rm -R ~/.thumbnails/fail simply pressing F5 while the desired nautilus window is active to force a reload.. otherwise it will reload next time you access said folder...

if its something your doing often... you can have it run automatically via cron https://help.ubuntu.com/community/CronHowto

1

Use this CLI script to quickly either overwrite or generate (in parallel) a large number of thumbnails.

usage: thumbnails.py [-h] [--overwrite] [--dotfiles] paths [paths ...]

A tool for generating Gnome thumbnails in parallel.

positional arguments:
  paths        The path(s) to thumbnail (typically one or more folders)

optional arguments:
  -h, --help   show this help message and exit
  --overwrite  Overwrite existing thumbnails.
  --dotfiles   Don't ignore directories prefixed with '.'

If I get 10 votes, I will make this an apt-packaged utility.

1
  • Here is the first vote for the apt-packaged utility ;) – loved.by.Jesus Sep 23 '20 at 20:15
0

On 14.04 and beyond

If this happens to you often you can automate the process on login by editing your ~/.profile file with your favorite editor and adding the following code to the bottom of the file.

# dump failed thumbnails
echo tag > /home/"$USER"/.cache/thumbnails/fail/gnome-thumbnail-factory/tag
if [ -d /home/"$USER"/.cache/thumbnails/fail/gnome-thumbnail-factory ] ; then
rm /home/"$USER"/.cache/thumbnails/fail/gnome-thumbnail-factory/*

The echo line is only there so that something exists in the failed thumbnail directory to avoid reporting an error at login. The next 2 lines just check for the existence of the failed thumbnail directory and if it exists, deletes the entire contents of that directory.

Sources: https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html#Bash-Startup-Files

https://askubuntu.com/a/795098/225694

https://askubuntu.com/a/20122/225694

How to regenerate a specific thumbnail in Nautilus?

testing

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