Monday, 6 May 2013

How to check what we have Installed in Debuian/Ubuntu OS


To check what have install by listing all using dpkg is easy.
dpkg -l
To check whether a package is install also easy.
dpkg -l | grep apache
The command above is some how redundant, because dpkg support wild characters, doing this instead
dpkg -l "apache*"
By doing this, it will also list the package that not install but available in dpkg cache, to install them you can simply apt-get. To indicate the packages installed it shows “ii” and not install shows “un”.
To know more, sometimes we wanna know what files is installed with the package. But with this query, you need to put the exact package name.
dpkg -L apache2
As contrast, if you wanna know the command(binaries) are from which package installed, check out this example.
To list more simple result for script manipulation? You can check out dpkg-query, it support -l and -L and more options. For example, -W will list only the package name and the version for installed packages.
dpkg-query -W "apache*"
To be more specific, check out the dpkg manual at -f, you can specified what should only output. A simple example, where I just want the package name.
dpkg-query -W -f='${Package}\n' "apache*"

No comments:

Post a Comment