Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

okay, so tyeing to type "icons" in the /usr/share/ directory, hit the delete key as root, now my icons are gone, all of them, the options for play in totem or the ones on the desktop....all of them, any help?

share|improve this question

I like Bash porn so I wrote you a present:

for p in `dpkg -l | awk '/^ii  [^\ ]+/ {print $2}'`; do
    if [[ $(dpkg -L $p | grep /usr/share/icons/) ]]; then
        echo $p;

That echos out all the installed packages that had files in /usr/share/icons/. If that works for you (it does for me) you can replace the echo statement with:

        sudo apt-get --reinstall install $p

It's going to use a lot of bandwidth and whatever you do, don't interrupt it, but it should get you all your packaged icons back.

Of course you can reverse that logic so you use something like this:

sudo apt-get --reinstall -s install $(for p in `dpkg -l | awk '/^ii  [^\ ]+/ {print $2}'`; do if [[ $(dpkg -L $p | grep /usr/share/icons/) ]]; then echo $p; fi; done)

The -s in there means simulation mode. That command won't actually do anything unless you remove the -s, it'll just show you what it would do. I'd probably recommend that before you jump in.

As Andrea points out dpkg -S can do all this on its own. Plus it's much quicker.

sudo apt-get -s --reinstall  install `dpkg -S /usr/share/icons/ | sed 's/,//g; s/\:.*$//'`
share|improve this answer
Wow. Lots of awesome stuff in there.. I'll be studying that script carefully! – SirCharlo Mar 15 '12 at 14:40
You can use dpkg -S /usr/share/icons/ instead of the for loop ;-) – Andrea Corbellini Mar 15 '12 at 15:19
@Oli Very nice(/clever/inteligent) loop. well done. – bioShark Mar 15 '12 at 23:02
I did the same thing and solved it using Andrea's solution and it worked fantastically as well as quickly. Thank you so much!!! – AyaneForever Mar 30 '12 at 19:23

You will need to do something like:

apt-get install --reinstall $package

You will need to replace $package with a list of package names, for every single package which had files under that path. That is quite a lot of packages, especially if you have any non-default packages installed.

Something like this might be a good start for you:

sudo apt-get install --reinstall aisleriot alacarte apport aptdaemon-data brasero-common bzr-gtk cabextract checkbox dmz-cursor-theme eog evince-common evolution-common file-roller gnome-accessibility-themes gnome-applets-data gnome-bluetooth gnome-control-center-data gnome-disk-utility gnome-icon-theme gnome-icon-theme-symbolic gnome-keyring gnome-mahjongg gnome-media gnome-nettool gnome-online-accounts gnome-panel-data gnome-power-manager gnome-session-common gnome-settings-daemon gnome-system-log gnome-system-tools gnome-themes-standard gwibber hicolor-icon-theme human-icon-theme human-theme humanity-icon-theme ibus jockey-common libgweather-common liblaunchpad-integration-common libpeas-common libreoffice-common nautilus-data network-manager-gnome onboard openjdk-7-jre rhythmbox-data seahorse software-center software-properties-gtk synaptic totem-common transmission-common ubuntu-artwork ubuntu-mono ubuntuone-client ubuntuone-installer unity-asset-pool update-manager update-notifier usb-creator-gtk xcursor-themes

share|improve this answer

oh :))

first of all :: don't do this again :)

now, depending on which icons you had, you should reinstall them back via synaptic, console, or USC (ubuntu software center), as was mentioned by 2 other answers

if icons were from default themes, them simply reinstall this gnome-icon-theme

ex. command from dobey will look like this

apt-get install --reinstall gnome-icon-theme
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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