All files of a code language, particularly python, do not display the proper file icons but instead look like text files - this only happens when the file contains some text.

empty file file with text

As you can see the file with no code saved to it ex18.py has the proper icon but ex1.py has code written to it and the icon looks like a .txt file.

How can I fix this?

  • Edit your question and add the output of mimetype ext18.py; mimetype ex1.py
    – A.B.
    Sep 22, 2015 at 5:00
  • Edit your question and add the output of ls -la /usr/share/thumbnailers
    – A.B.
    Sep 22, 2015 at 9:33

2 Answers 2


The configuration for the thumbnailers for your file manager are in


and the binaries are in



cat evince.thumbnailer

[Thumbnailer Entry]
Exec=evince-thumbnailer -s %s %u %o
  1. Identify the thumbnailer configuration for the mimetype



    grep -r 'text/x-python' /usr/share/thumbnailers

    or only the file name of the thumbnailer configuration with

    grep -ro 'text/x-python' /usr/share/thumbnailers | awk -F: '{print $1}'
  2. Disable the thumbnailer configuration via

    grep -ro 'text/x-python' /usr/share/thumbnailers | awk -F: '{system("sudo chmod o-r " $1)}'
  3. Enable via (now you need sudo)

    sudo grep -ro 'text/x-python' /usr/share/thumbnailers | awk -F: '{system("sudo chmod o+r " $1)}'

Ahh, check this out : Icons for source code files are not proper in Ubuntu file manager

Did you try sudo rm -rf ~/.thumbnails/* ~/.cache/thumbnails/*

These files are generated automatically. Please post an answer to this question if the above did not work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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