Until some weeks ago I used to use only apt-get, and then I realized that aptitude is better in taking care of orphan packages.

I am no expert here, but this is the way I think they both work, at least on Debian Etch, I have heard that in Lenny both works more or less the same, I use Lenny, and yes they can do the same thing but in different ways.

Well when you install a package with apt-get, and that packages needs other packages due to dependencies, it will install all of them for you, which is great, but then when you want to remove the installed package, apt-get will let the automatically installed packages in your PC, while aptitude will rid them away. Aptitude marks all installed packages as “manual installed” and “automatically installed”, the first are those you explicitly ask it to install and the latter are those which it decided to install by you, because they are needed, so when you ask aptitude to remove a package it will remove also the automatically installed ones, since Lenny you can use them both, just be sure to use autoremove with apt-get

Here are some examples with mplayer

ggarron@debian:~$ sudo apt-get install mplayer
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libamrnb3 libamrwb3 libasyncns0 libfaac0 libggi2 libgii1 libgii1-target-x libpulse0 libx264-57 libxvidcore4 mplayer-skin-blue
Suggested packages:
  libggi-target-emu libggi-target-monotext libggimisc2 pulseaudio mplayer-doc w32codecs
Recommended packages:
  libggi-target-x libggi-target
The following NEW packages will be installed:
  libamrnb3 libamrwb3 libasyncns0 libfaac0 libggi2 libgii1 libgii1-target-x libpulse0 libx264-57 libxvidcore4 mplayer mplayer-skin-blue
0 upgraded, 12 newly installed, 0 to remove and 100 not upgraded.
Need to get 0B/6785kB of archives.
After unpacking 15.7MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Selecting previously deselected package libasyncns0.
(Reading database ... 116538 files and directories currently installed.)
Unpacking libasyncns0 (from .../libasyncns0_0.3-1_i386.deb) ...
Selecting previously deselected package libfaac0.
Unpacking libfaac0 (from .../libfaac0_1.26-0.1_i386.deb) ...
Selecting previously deselected package libgii1-target-x.
Unpacking libgii1-target-x (from .../libgii1-target-x_1%3a1.0.1-3_i386.deb) ...
Selecting previously deselected package libgii1.
Unpacking libgii1 (from .../libgii1_1%3a1.0.1-3_i386.deb) ...
Selecting previously deselected package libggi2.
Unpacking libggi2 (from .../libggi2_1%3a2.2.1-5_i386.deb) ...
Selecting previously deselected package libpulse0.
Unpacking libpulse0 (from .../libpulse0_0.9.9-1_i386.deb) ...
Selecting previously deselected package libx264-57.
Unpacking libx264-57 (from .../libx264-57_0.svn20071224-0.0_i386.deb) ...
Selecting previously deselected package libxvidcore4.
Unpacking libxvidcore4 (from .../libxvidcore4_2%3a1.1.3-0.3_i386.deb) ...
Selecting previously deselected package mplayer-skin-blue.
Unpacking mplayer-skin-blue (from .../mplayer-skin-blue_1.6-2_all.deb) ...
Selecting previously deselected package libamrnb3.
Unpacking libamrnb3 (from .../libamrnb3_7.0.0.0-0.0_i386.deb) ...
Selecting previously deselected package libamrwb3.
Unpacking libamrwb3 (from .../libamrwb3_7.0.0.2-0.1_i386.deb) ...
Selecting previously deselected package mplayer.
Unpacking mplayer (from .../mplayer_1%3a1.0.rc2svn20071207-0.2_i386.deb) ...
Setting up libasyncns0 (0.3-1) ...
Setting up libfaac0 (1.26-0.1) ...
Setting up libgii1-target-x (1:1.0.1-3) ...
Setting up libgii1 (1:1.0.1-3) ...
Setting up libggi2 (1:2.2.1-5) ...
Setting up libpulse0 (0.9.9-1) ...
Setting up libx264-57 (0.svn20071224-0.0) ...
Setting up libxvidcore4 (2:1.1.3-0.3) ...
Setting up mplayer-skin-blue (1.6-2) ...
Setting up libamrnb3 (7.0.0.0-0.0) ...
Setting up libamrwb3 (7.0.0.2-0.1) ...
Setting up mplayer (1:1.0.rc2svn20071207-0.2) ...

It is now installed, lets uninstall it, first using apt-get

ggarron@debian:~$ sudo apt-get remove mplayer
[sudo] password for ggarron: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libxvidcore4 libamrnb3 libx264-57 libamrwb3 libggi2 libgii1 mplayer-skin-blue libgii1-target-x libasyncns0 libpulse0 libfaac0
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  mplayer
0 upgraded, 0 newly installed, 1 to remove and 100 not upgraded.
Need to get 0B of archives.
After unpacking 10.8MB disk space will be freed.

As you can see not all the dependencies are going to be uninstalled, and apt-get itself recommends you to use autoremove

Let’s try with it now:

ggarron@debian:~$ sudo apt-get autoremove mplayer
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libxvidcore4 libamrnb3 libx264-57 libamrwb3 libggi2 libgii1 mplayer-skin-blue libgii1-target-x libasyncns0 libpulse0 libfaac0
The following packages will be REMOVED:
  libamrnb3 libamrwb3 libasyncns0 libfaac0 libggi2 libgii1 libgii1-target-x libpulse0 libx264-57 libxvidcore4 mplayer mplayer-skin-blue
0 upgraded, 0 newly installed, 12 to remove and 100 not upgraded.
Need to get 0B of archives.
After unpacking 15.7MB disk space will be freed.

Now it is working better, try now aptitude

ggarron@debian:~$ sudo aptitude remove mplayer
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Reading extended state information      
Initializing package states... Done
Reading task descriptions... Done  
Building tag database... Done    
The following packages are unused and will be REMOVED:
  libamrnb3 libamrwb3 libasyncns0 libfaac0 libggi2 libgii1 libgii1-target-x libpulse0 libx264-57 libxvidcore4 mplayer-skin-blue 
The following packages have been automatically kept back:
  cpp-4.2 dpkg-dev evolution evolution-common evolution-data-server evolution-data-server-common g++-4.2 gcc-4.2 gij gnome-cards-data gnome-games gnome-games-data gnome-mount gtk2-engines-pixbuf 
  java-gcj-compat kdelibs4c2a libafterimage0 libaprutil1 libcupsimage2 libcupsys2 libcurl3 libcurl3-gnutls libexchange-storage1.2-3 libffi4 libgcj-bc libgconf2-4 libglib2.0-0 libgomp1 libgtk2.0-0 
  libgtk2.0-bin libgtk2.0-common libhsqldb-java libopal-2.2 libpq5 libpt-1.10.10 libqt4-core libqt4-gui libqt4-qt3support libqt4-sql libsane libsmbclient libsoup2.2-8 libstdc++6-4.2-dev libungif4g libxine1 
  libxine1-console libxine1-ffmpeg libxine1-gnome libxine1-misc-plugins libxine1-plugins libxine1-x liferea-xulrunner nautilus nautilus-cd-burner nautilus-data openoffice.org-base openoffice.org-calc 
  openoffice.org-common openoffice.org-core openoffice.org-draw openoffice.org-filter-binfilter openoffice.org-gtk openoffice.org-impress openoffice.org-math openoffice.org-officebean 
  openoffice.org-style-andromeda openoffice.org-style-tango openoffice.org-writer python-apt python-uno qt4-qtconfig vim-gnome vim-gui-common vim-runtime 
The following packages have been kept back:
  apt apt-utils aptitude cupsys epiphany-browser epiphany-extensions evolution-exchange evolution-plugins evolution-webcal gcc-4.2-base gnupg gthumb hardinfo imagemagick libgcc1 libnfsidmap2 libstdc++6 
  liferea netcat openoffice.org openoffice.org-evolution openoffice.org-gnome openoffice.org-help-en-us synaptic vim-common vim-tiny 
The following packages will be REMOVED:
  mplayer 
0 packages upgraded, 0 newly installed, 12 to remove and 100 not upgraded.
Need to get 0B of archives. After unpacking 15.7MB will be freed.
Do you want to continue? [Y/n/?] n

It works the same, so since Lenny it seems to be the same if you use apt-get or aptitude, but until Etch (I have not tested it) you better use aptitude as apt-get does not take care of the orphans.

If you have comments, or know something else please comment this post.

And you may want to read this