Accidentally deleted icons in /usr/share, how do I get them back?
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;
fi;
done
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/\:.*$//'`
You will need to do something like:
sudo 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