Basic commands of dpkg
Debian is one of the earliest Linux distribution around. It caught the public's fancy because of the ease of installing and uninstalling applications on it. When many other linux distributions were bogged down in dependency hell, Debian users were shielded from these problems owing to Debian's superior package handling capablities using apt-get.Here I will explain how to go about using this package handling utility to get the results that you desire.
The first step needed to use apt-get to your advantage is including the necessary repositories. Repositories are merely collections of softwares which are stored in a public location on the internet. By including the web address of these repositories, you are directing apt-get to search these locations for the desired software. You use the /etc/apt/sources.list file to list the addresses of the repositories. It takes the following format:
deb [web address] [distribution name][maincontribnon-free]For example, in Ubuntu a debian based distribution, it could be something like this:deb http://in.archive.ubuntu.com/ubuntu breezy main restrcted# apt-get update# apt-cache search baseutils# apt-get install baseutilsAnd removing a package is as simple as running the command:
# apt-get remove baseutils# apt-cache stats
Total package names : 22502 (900k)
Normal packages: 17632
Pure virtual packages: 281
Single virtual packages: 1048
Mixed virtual packages: 172
Missing: 3369
...# apt-get upgrade# apt-get dist-upgradeSaving valuable hard disk space# apt-get clean# apt-get autocleandpkg - The low level Package management utility# dpkg -i gedit-2.12.1.debTo remove an installed package, run the command:# dpkg -r gedit# dpkg -P gedit# dpkg -c gedit-2.12.1.deb# dpkg -I gedit-2.12.1.deb# dpkg -l gcc*
Desired=Unknown/Install/Remove/Purge/Hold
Status=Not/Installed/Config-files/Unpacked/Failed-config/.
/ Err?=(none)/Hold/Reinst-required/X=both-problems
/ Name Version Description
+++-===============-==============-========================
ii gcc 4.0.1-3 The GNU C compiler
ii gcc-3.3-base 3.3.6-8ubuntu1 The GNU Compiler Colletio
un gcc-3.5 none (no description available)
un gcc-3.5-base none (no description available)
un gcc-3.5-doc none (no description available)
ii gcc-4.0 4.0.1-4ubuntu9 The GNU C compiler
...# dpkg -s gedit# dpkg -L beagle# dpkg -L beagle | grep html$Search for a filename from installed packages. All standard shell wildchars can be used in the pattern.
dpkg -p|--print-avail package
Display details about package, as found in /var/lib/dpkg/available.
dpkg --update-avail | --merge-avail Packages-file
Update dpkg's and dselect's idea of which packages are available. With action --merge-avail, old information is combined with information from Packages-file. With action --update-avail, old information is replaced with the information in the Packages-file. The Packages-file distributed with Debian GNU/Linux is simply named Packages. dpkg keeps its record of available packages in /var/lib/dpkg/available.
dpkg -A | --record-avail package_file ...
Update dpkg and dselect's idea of which packages are available with information from the package package_file. If --recursive or -R option is specified, package_file must refer to a directory instead.
dpkg -l | --list package-name-pattern ...
List packages matching given pattern. If no package-name-pattern is given, list all packages in /var/lib/dpkg/available. Normal shell wildchars are allowed in package-name-pattern. (You will probably have to quote package-name-pattern to prevent the shell from performing filename expansion. For example, dpkg -l 'libc5*' will list all the package names starting with "libc5".)
dpkg -s | --status package-name ...
Report status of specified package. This just displays the entry in the installed package status database.
Get a list of everything you've installed?
dpkg -l '*'
List each available package whose name matches thunderbird.
# apt-cache pkgnames | grep thunderbird
"dpkg --force-help" is your friend.