A few quick tips for apt
Here are a few tricks for APT, the Advanced Packaging Tool used on Debian and Debian-based distributions like Ubuntu.
View all the packages installed on a system
The easiest way to do it is:
dpkg –get-selections
It does not require to be root, and will display all the packages installed via APT. For example, the first lines may look something like:
$ dpkg --get-selections | head
acetoneiso2 install
acidrip install
acpi-support-base install
acpid install
adduser install
akregator install
alien install
alsa-base install
alsa-oss install
alsa-utils install
You can also put the entire list in a text file by redirecting the output, like this:
dpkg –get-selections > installed_packages.txt
Then read this file with a text editor or using less installed_packages.txt.
List files which get installed by a package
-L is a handy parameter to dpkg which will show you what files a package will install.
dpkg -L package_name
For example:
dpkg -L amarok
Will show all the files which are going to be installed by package amarok. You don’t have to be root to run it.
Install the dependencies of an application
Sometimes you need to compile from source a newer version of an application which is already included in the repositories. For example, to install the development libraries for BasKet, you would run as root:
apt-get build-dep basket
And then you can proceed to compile your application. Note that sometimes newer versions of applications may depend on newer libraries or other packages than you do not have in the repositories, so this won’t always work.







