Both Debian and Ubuntu Linux provides a number of package management tools. This article summaries package management command along with it usage and examples for you.
(1) apt-get : APT is acronym for Advanced Package Tool. It supports installing packages over internet (ftp or http). You can also upgrade all packages in single operations, which makes it even more attractive.
(2) dpkg : Debian packaging tool which can be use to install, query, uninstall packages.
(3) Gui tools:
You can also try GUI based or high level interface to the Debian GNU/Linux package system. Following list summaries them:
(1) aptitude: It is a text-based interface to the Debian GNU/Linux package system.
(2) synaptic: GUI front end for APT
apt-get add a new package
Add a new package called samba
Syntax: apt-get install {package-name}
# apt-get install samba
apt-get remove the package called samba but keep the configuration files
Syntax: apt-get remove {package-name}
# apt-get remove samba
apt-get remove (erase) package and configuration file
Syntax: apt-get --purge remove {package-name}
# apt-get --purge remove samba
apt-get Update (upgrade) package
To upgrade individual package called sudo, enter:# apt-get install sudo
apt-get display available software updates
# apt-get upgrade samba
dpkg command to get package information such as description of package, version etc.
Syntax: dpkg --info {.deb-package-name}
# dpkg --info sudo_1.6.7p5-2_i386.deb | less
List all installed packages
# dpkg -l
To list individual package try such as apache
# dpkg -l apache
# dpkg -l | grep -i 'sudo'
To list packages related to the apache:
# dpkg -l '*apache*'
# dpkg -L samba
# dpkg --contents sudo_1.6.7p5-2_i386.deb
Find, what package owns the file /bin/netstat?
Syntax: dpkg -S {/path/to/file}
# dpkg -S /bin/netstat
Search for package or package description
Find out all the Debian package which can be used for Intrusion Detection
# apt-cache search "Intrusion Detection"
# apt-cache search sniffer
Find out if Debian package is installed or not (status)
Syntax: dpkg -s {package-name} | grep Status
# dpkg -s samba| grep Status
List ach dependency a package has...
Display dependencies for lsof and mysql-server packages:
# apt-cache depends lsof<br /># apt-cache depends mysql-server<br />
Further reading
- Our dpkg cheat sheet
- Our apt-get cheat-sheet
- APT Howto
- APT and Dpkg Quick Reference Sheet
REFERENCES
http://www.cyberciti.biz/tips/linux-debian-package-management-cheat-sheet.html