One of the lesser known but very useful features of
aptitude is user tags.
For example, someone wants to install a set of packages temporarily just to build some program from source. Later, when the -dev packages are not needed anymore, it is not easy to remember which packages were installed.
Fortunately, one may tag the packages during install (I use
builddeps tag in the example below):
$ sudo aptitude install --add-user-tag builddeps \ libsomething-dev libsomething-else-dev ...
Now when these packages are to be deleted, we just do:
$ sudo aptitude purge '?user-tag(builddeps)'
The search pattern
?user-tag(yourtag) can be used with any other aptitude search patterns. Also, you may tag packages during many other commands, not only
Tested in Debian Lenny (