Purge deinstalled packages[-][--][++]

You can see a list of all packages installed by dpkg --get-selections, some packages will say "deinstall" next to them, \
this means that package has been uninstalled, but old data is still ramaining. You can purge these uninstalled packages by \
dpkg --purge the-nameof-the-package. If you wanted to write a loop to --purge all package with deinstall, do this

for i in $(dpkg --get-selections|grep deinstall|awk '{print $1}'); do dpkg -P $i; done

To Count installed packages

dpkg --get-selections|grep install|wc -l

Install from particular branch[-][--][++]

This is for debian distro anyway

apt-get -t testing install amarok
apt-get -t unstable upgrade

apt-cache search packagename

apt-get upgrade (after editing /etc/apt/sources.lst)

How can I fix the debian apt-get error: "E: Dynamic MMap ran out of room"
During apt-get update, you may see this error.
The simple way to solve it is like so:
cat << EOF >> /etc/apt/apt.conf
APT::Cache-Limit "10000000";(hit return here)
EOF (hit return again)

Thus, when you 'cat /etc/apt/apt.conf' it should contain:
APT::Cache-Limit "10000000";

or higher, I had to use 90000000