How do I refresh the icon cache?

62,371

Solution 1

Run the following in a terminal:

sudo update-icon-caches /usr/share/icons/*

From man page:

update-icon-caches is a wrapper script for updating the icon caches in a list of directories.

In each of the directories passed as arguments, the icon cache is updated if it is already present. It is not created if it does not already exist.

If the theme index file is not present, the icon cache is removed.

Solution 2

You need to:

Note: hicolor is the default theme which app developers should use. If you're making an icon theme, refresh your icon theme's folder instead.

sudo touch /usr/share/icons/hicolor ~/.local/share/icons/hicolor
sudo gtk-update-icon-cache

See (the only documentation I can find for this): https://fedoraproject.org/wiki/Packaging:Scriptlets#Icon_Cache

Solution 3

If using Unity (until Ubuntu 17.04): At the terminal command prompt type:

$ unity

This will update your *.desktop icons in the Launcher.

If the problem is not the Ubuntu Launcher but the application itself, take a look stackoverflow.com for programming resolutions.

A similar issue to this is answered at here. Also look here.

Solution 4

From Unix SE: Please refer to the XDG Desktop Menu Specification. To update the list of available desktop launchers in the Applications menu please run:

xdg-desktop-menu forceupdate

The update will be reflected in couple seconds.

Share:
62,371

Related videos on Youtube

soapergem
Author by

soapergem

I program things in Python. I'm AWS certified. I love Terraform. In the past I've programmed things in C#, Java, PHP, and more.

Updated on September 18, 2022

Comments

  • soapergem
    soapergem over 1 year

    First of all, I'm not 100% positive that the main question I've written here is actually the problem, but I have a hunch that it is. I've wrote a simple Gtk# application in Mono awhile ago, and gave it a custom ICO as its icon file. Worked great.

    Recently I went to change out this icon to a different one, but when I build and run the program it still shows the icon. I've made sure that I've updated every reference to the icon file to the new one, and have completely deleted the old icon off the hard drive altogether. But it still shows up in the Launcher when I run the program.

    I am assuming this means that Gtk caches the icons somewhere in Ubuntu and I probably need to force that to refresh. Any advice?

  • soapergem
    soapergem over 8 years
    This did not work
  • Apologician
    Apologician over 8 years
    @SoaperGEM The unity the issue with the actual launcher. Running unity at a command prompt will refresh the Ubuntu's Launcher Icons. My answer was directed toward a Ubuntu Launcher issue. Since it's not working it's most likely a gtk programming issue. You might get better (quicker) answers with the actual gtk programming issue at stackoverflow.com. After resolving the actual Icon display of the gtk program that is when you would run the unity command to update Ubuntu's Launcher cache. Give me 5 minutes to update my answer.
  • Ace
    Ace over 6 years
    this answer needs a warning on it.
  • Apologician
    Apologician over 6 years
    @Ace Can you elaborate on the warning?
  • Ace
    Ace over 6 years
    @L.D.James , currently running unity will force close all running applications and restart unity. I lost data in my browser because of this.
  • Apologician
    Apologician over 6 years
    @Ace Which version of Ubuntu are you running? My answer was in reference to what was the current version, 16.04 LTS at the time. I use the command often for the purpose of recovering sessions that might be locked by a problematic app. I use it to avoid losing data in my 10's of open windows and applications. I haven't seen any documenting indicating this behavior has changed. If you tell me the version of Ubuntu you are running I'll install that version and test the behavior. If you lost something, I'm sure it's related to something else, not the unity command.
  • mirh
    mirh over 5 years
    It happens with 16.04 indeed. And I, for one, couldn't even get unity to start, so I had to reboot the whole pc. Of relevance is the fact I'm not an administrator.
  • ankostis
    ankostis almost 5 years
    +1, works flawlessly on wayland.
  • Jamie Carl
    Jamie Carl over 4 years
    Still relevant. Just fixed my app icon issue on Ubuntu 19.04.
  • geekley
    geekley over 2 years
    Had similar problem on my Kubuntu 20.10, on dolphin, where my custom filetype icon wouldn't refresh. It seems only deleting ~/.cache/icon-cache.kcache and restarting dolphin solved it.