Here are some aptitude commands I use regularly but not often enough to remember each time…
List of manually installed packages. Usefull to clone an installation:
aptitude search -F%p ~i\!~M
- -F set a format string.
- %p is replaced by the package name.
- ~i select all installed packages.
- !~M excludes automaticaly installed packages.
With actually installed versions (usefull if some packages comes from backports or external repositories:
aptitude search --disable-columns -F%p=%v ~i\!~M
- --disable-columns unset displaying in columns and taking all terminal width.
- %v replaced by the version of the package.
Example: to clone a host (after copying all sources.list files):
aptitude install $(ssh machine_modele aptitude search --disable-columns -F%p=%v ~i\!~M |tr '\n' ' ')
Find updates available in backports or experimental:
aptitude versions '~W(~Awheezy-backports(~W(~i!~M)))'
aptitude versions '~W(~Aexperimental(~W(~i!~M)))'
- ~W ignores the version selected by another filter.
- ~Axxx select packages from archive xxx.
Lists upgradable packages:
aptitude search ~U
With version numbers:
aptitude search --disable-columns -F'%p %v %V' ~U
Lists modified configuration files:
sudo debsums -ce
Backup debconf configurations:
sudo debconf-get-selections > /tmp/conf-paquets.txt
To import as this befor installing packages:
sudo debconf-set-selections < /tmp/conf-paquets.txt
To be continued…