Skip to content

Instantly share code, notes, and snippets.

@parastuffs
Last active August 29, 2015 14:24
Show Gist options
  • Save parastuffs/c4c73e3bbe021710647d to your computer and use it in GitHub Desktop.
Save parastuffs/c4c73e3bbe021710647d to your computer and use it in GitHub Desktop.
Remove common i386/amd64 packages
#!/bin/bash
i=1
echo "Get AMD64 packages"
sudo aptitude search '~ramd64~i' | awk '{print $2}' > packages.amd64
echo "Get i386 packages"
sudo aptitude search '~ri386~i' | awk '{print $2}' | sed -e 's/:i386//' > packages.i386
echo "Compute common lines"
comm -1 -2 --nocheck-order packages.i386 packages.amd64 > packages.comm
tot=`cat packages.comm | wc -l`
echo "${tot} common packages to remove."
for deb in `cat packages.comm`; do
echo "######################################"
echo "Remove ${deb}:i386 (${i}/${tot})"
echo "######################################"
sudo dpkg -r ${deb}:i386
i=$((i+1))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment