Important Update
Apparently the new version of apt-get in Edgy Eft (Ubuntu 6.10) has a function that allows you to remove unused dependencies when removing an application:
sudo apt-get autoremove applicationname
So the points outlined on this page about using aptitude over apt-get are largely irrelevant if you’re using Edgy Eft (6.10), Feisty Fawn (7.04), or any future version of Ubuntu.
Information Relevant to Older Versions of Ubuntu
You may notice that many Ubuntu websites ask you to install software using the apt-get command. Others may use the aptitude command instead. In many ways, they’re the same in that they both draw from the repositories in your /etc/apt/sources.list to retrieve and install software.
Below is the demonstrated difference, though, at least for Ubuntu 6.06 and earlier. The example displayed is the package kword, but it works the same for any package that has dependencies.
Both aptitude and apt-get will install kword and its dependencies (kspread, kword-data, and libwv2-1c2), but only aptitude will actually remove the dependencies when kword is removed (and only if no other packages depend on those dependencies).
Note: In order for aptitude to work properly, you must first do an update, then an install. Also, you cannot install with apt-get or Synaptic and then expect to have dependencies removed by uninstalling with aptitude.
If you were unfortunate enough to use apt-get, and you want to clean out some unused dependencies, you can install and use deborphan or the graphical frontend gtkorphan (now available in Dapper if you enable extra repositories). Naturally, you would install it this way:
sudo aptitude update
sudo aptitude install gtkorphan