Wednesday, December 10, 2008

Debian Linux apt-get package management cheat sheet

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

Red hat Linux package names generally end in .rpml similarly Debian
package names end in .deb, for example:

apache : Package name
1.3.31-6 : Version number
i386 : Hardware Platform on which this package will run (i386 == intel
x86 based system)
.deb : Extension that suggest it is a Debian package

Remember whenever I refer .deb file it signifies complete file name, and
whenever I refer package name it must be first part of .deb file. For
example when I refer to package sudo it means sudo only and not the .deb
file i.e. sudo_1.6.7p5-2_i386.deb. However do not worry you can find out
complete debian package list with the following command:
apt-cache search {package-name}
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

Syntax: apt-get upgrade

To upgrade individual package called sudo, enter:
# apt-get install sudo
apt-get display available software updates

Following command will display the list of all available upgrades
(updates) using -u option, if you decided to upgrade all of the shown
packages just hit 'y'
# apt-get upgrade samba

However if you just wish to upgrade individual package then use apt-get
command and it will take care of rest of your worries:
Syntax: apt-get install {package-name}
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

Syntax: dpkg -l
# dpkg -l
To list individual package try such as apache
# dpkg -l apache

You can also use this command to see (verify) if package sudo is install
or not (note that if package is installed then it displays package name
along with small description):
# dpkg -l | grep -i 'sudo'

To list packages related to the apache:
# dpkg -l '*apache*'

List files provided (or owned) by the installed package (for example
what files are provided by the installed samba package)
Syntax: dpkg -L {package-name}
# dpkg -L samba

(H) List files provided (or owned) by the package (for example what
files are provided by the uninstalled sudo package)
Syntax: dpkg --contents {.deb-package-name}
# 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

Some times you don’t know package name but aware of some keywords to
search the package. Once you got package name you can install it using
apt-get -i {package-name} command:
Syntax: apt-cache search "Text-to-search"
Find out all the Debian package which can be used for Intrusion Detection
# apt-cache search "Intrusion Detection"

Find out all sniffer packages
# 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 a listing of each dependency a package has and all the possible
other packages that can fulfill that dependency. You hardly use this
command as apt-get does decent job fulfill all package dependencies.
Syntax: apt-cache depends package

Display dependencies for lsof and mysql-server packages:
# apt-cache depends lsof
# apt-cache depends mysql-server

Source: and

Ubuntu Bangladesh mailing list


Anonymous said...

you should finally use aptitude instead of apt-get. as recommended

Bauani said...

This article has been on main page of 'Debian Linux Technical' news site on 12th december, 2008. Thanks to CJ2003 for his posting. Here is the link on Debian Linux News Site Article.

Other Posts

Labels / Category

2013 (1) 3G (4) Adsense (2) AKTEL (2) Amateur Radio (3) APNIC (5) Bajaj Discovery (1) Bajaj Pulsar (1) Bangla News (5) Bangladesh (29) Bangladesh Computer Market (1) Bangladesh Cricket (2) Bangladesh earthquake (3) Bangladesh Educational Board (1) Bangladesh Energy (4) Bangladesh ICT (15) Bangladesh Internet Service (15) Bangladeshi Credit Card (3) Bangladeshi News Site (3) Bank in Bangladesh (7) Bank of Bangladesh (10) Banking in Bangladesh (10) BGMEA Bulding (1) Big File Download (3) blackhat (1) BLOG (6) Bogon (3) bot (2) BTCL (3) BTRC (14) BTTB Internet (10) BTTB Submarine Cable (9) Byke Hijack (1) Cacti (1) Call Block (1) Carbon Credit (1) CentOs (2) CentOs Bangladesh (2) Charity (2) Chrome (2) Computer Booting (1) Credit Card (10) Credit Card in Bangladesh (8) Crime (3) CyberCrime (11) Cyclon (1) DDoS (8) Dengue (1) Denmark (1) Dhaka earthquake (5) DNS (3) DNSSEC (2) Domain (9) DoS (4) dot bd domain (3) Dot CO.CC (2) Download (4) Drive not opening on click (1) DV Lottery 2010 (2) E-Learning (1) earthquake (5) EARTHQUAKE BANGLADESH (2) EARTHQUAKE DHAKA (2) earthquake in Bangladesh (5) earthquake in Dhaka (5) Email (7) Email Full Header (3) Email Sender Identify (4) Entertainment (2) Fake Email Sender (5) Firefox (8) FTP (1) Funny (4) GMail (4) Google (18) GPRS Settings (1) GrameenPhone (1) HAM (4) Health (3) Hobby (1) IGW (3) IIG (3) India (1) Indian ICT (1) Indian IT (1) Internet (19) Internet Mail (1) Internet Security (9) iPhone (3) iPhone Bangla (2) iPhone Bangladesh (2) iPhone in Dhaka (2) iPod (1) IPv4 Allocation (8) ipv6 (10) islam (4) ISOC (3) Linux Articles (6) Metal News (1) Microsoft (4) Microsoft buy Yahoo (1) Mirror Server (1) Mobile Phone (3) Mobile Phone Internet (1) Mobile Phone News (3) Mobile Phone Operator (6) Mobile Phone User (3) Mozilla (8) Mozilla Firefox (8) Myself (1) Mystery (1) Netcraft (4) Network Monitoring (4) neverBot (2) News Site (1) Nokia (3) Oil Price (2) Online Security (7) Paypal in Bangladesh (6) Personal View (1) Phishing (2) Pigeons (1) Postfix (7) PSTN (2) RANGS Bulding (1) Relay Host (2) robot.txt (1) robots.txt (2) Scour (2) (2) Second submarine cable (3) Sendmail (4) Share Market (4) Smart Relay (3) SSC Result (1) SSC Result 2008 (1) Stock Market (3) Technology (1) Ubuntu (4) UCB (5) UCBL (5) URL Redirect (2) Virus (3) Virus Infected Windows (3) Virus Information (3) Warid (2) Web Spider (3) Webhosting (6) Wimax (4) Windows (1) Windows Problems (1) Wireless Internet in Bangladesh (5) Yahoo (4) Yahoo Sold (1)

Share it