Debian/Ubuntu apt-get tricks.
apt-get install foobar
apt-cache search foobar
You can query files to see which packages own them, or query packages to see which files own them.
apt-get install apt-file
Build apt-get file information cache
Query through the packages to determine which package contains the file
apt-file search mysqld
Query the other way around, you know the package name and would like info about all the files which are provided by a given pacage:
apt-file list mysqld
List all installed software/packages
dpkg --get-selections > software.txt
That will save your installed list to a file called software.txt. That list is every piece of software required to reproduce the state your PC is currently in.
Another way to get a full list of installed software is to run the command
To restore a PC the list above
# dpkg --set-selections < software.txt # apt-get dselect-upgrade
Clearing up space
Delete archived packages that are considered old.
# apt-get autoclean
Delete all archieved packages
# apt-get clean
Remove every file from a package
apt-get remove foobar --purge