The Issue:When I type:dpkg-query -Wf '${Package;-40}${Priority}\n' | sort -b -k2,2 -k1,1I get a list of all installed packages on my machine, example:...raspberrypi-artwork                     extraraspberrypi-bootloader                  extraraspberrypi-ui-mods                     extraraspi-config                            extrarpi-update                              extrasonic-pi                                extrassh                                     extratriggerhappy                            extrawireless-tools                          extraxkb-data                                extraadduser                                 importantapt                                     importantapt-utils                               importantaptitude                                importantaptitude-common                         importantbsdmainutils                            important...I have recently run a script that installed way to many things and now my machine responds with: /usr/bin/mandb: can't write to /var/cache/man/2694: No space left on device (the paths change but it always tells me there is no space left.)The possible labels I see are:standardextraimportantoptionalrequiredI have uncommitted changes in various repos and I want to be able to push my local changes but I keep getting this error when I attempt to push:$ git pushfatal: write error: No space left on deviceerror: Couldn't write .git/refs/remotes/origin/master.lockerror: Cannot update the ref 'refs/remotes/origin/master'.Everything up-to-dateI should also say that I know everything is not up to date.The System:This is on a raspberry pi running wheezy raspbian.The question:I have several hundred packages installed. How do I remove all packages labeled 'extra'? Is this the best way to free space on my machine? I have uncommitted changes in various repos and I want to be able to push my local changes.I would also accept an answer that removes everything but required and important. Git is labeled under optional and I would prefer to keep this (though I can always install it again after removing all unneeded packages).Thanks in advance!!
write error: No space left on device. Removing 'extra' packages. Attempting recovery
apt;package management;git;aptitude
You can use the following command to purge all optional and extra packages:sudo apt-get --simulate purge $(dpkg-query -Wf '${Package;-40}${Priority}\n' | awk '$2 ~ /optional|extra/ { print $1 }')The --simulate flag lets you see what will be removed without actually removing everything. Remove the flag to actually uninstall packages.You will need to reinstall git, as it will be removed along with the other optional and extra packages.You might need some optional and extra packages, so remove with care.More here: https://askubuntu.com/questions/79665/keep-only-essential-packages