Stupid APT (and dpkg) Tricks
A short list of some of the apt and dpkg commands I use regularly. Working in a terminal this way is usually faster and more convenient than using graphical front ends to APT. Users logged in as root don’t need to type in sudo where specified.
Get an updated list of packages. This is important before installing new software or upgrading.
# sudo apt-get update
Upgrade your installed packages.
# sudo apt-get upgrade
This helps you to perform more complex upgrades (such as upgrading to a new version of your distribution).
# sudo apt-get dist-upgrade
Use this to search for packages. Multiple terms can be used, so using pipes and grep is usually overkill.
# apt-cache search [search terms]
Install packages. You can usually install as much as you want and go off for a sandwich while it downloads and installs the packages.
# apt-get install [name of packages]
# apt-get remove [name of packages]
Remove packages that were automatically installed, but now are no longer needed.
# apt-get auto-remove
Display all installed packages.
# dpkg -l
Display all installed packages related to compiz (for example).
# dpkg -l '*compiz*'
Determine what packages were installed when on your system.
# ls -tl /var/lib/dpkg/info/ | less