1

I read Where are icons stored? about the location of Ubuntu built-in icons (for instance /usr/share/icons/gnome/256x256/appsgnome-terminal.png).

But I am confused about the icon location of a new image, for instance. Let's say I have in a specific directory, a very large .eps or .bmp file and I would like to know where its icon(s) is/are located (if somewhere) and how I can access it/them.

0

1 Answer 1

5

Depending on the programm that processes the thumbnails, the "icons" are usually located either in ~/.thumbnails/ or ~/.cache/thumbnails/.

The file name of the thumbnail is the md5sum of the full path + .png extension. So for finding the thumbnail of a given file you can use this function:

find_thumbnail(){
    full_path="file://$(realpath -s "$1")"
    md5name=$(printf %s "${full_path// /%20}" | md5sum)
    find ~/.thumbnails/ ~/.cache/thumbnails/ -name "${md5name%% *}.png"
}


Usage:
======
find_thumbnail /path/to/file.bmp
find_thumbnail ~/Pictures/file.jpg
find_thumbnail file.jpg
find_thumbnail "file with spaces.tif"
3
  • 2
    +1; This works, but it will not work when there are any spaces in the filename or any directory in it's path. Spaces would have to be converted to %20 before piping to md5sum.
    – mook765
    Oct 18, 2018 at 10:03
  • 1
    Thanks, I have fixed this. Is space the only character that doesn't work ?
    – pLumo
    Oct 18, 2018 at 10:30
  • It could be possible that other strange characters might lead to confusion, but I think the space is the most common problem. One should not use strange characters in file names anyway even if it is permitted. Some characters (like$ or a leading hyphen -) are well known to confuse Bash. In doubt, one can always rename a file to avoid this.
    – mook765
    Oct 18, 2018 at 12:39

You must log in to answer this question.

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