1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head xmlns="http://www.w3.org/1999/xhtml">
5
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6
<title xmlns="">dpkg</title>
7
<link rel="stylesheet" href="../../libs/ubuntu-book.css" type="text/css" />
8
<link rel="home" href="index.html" title="Ubuntu Server Guide" />
9
<link rel="up" href="package-management.html" title="Chapter 3. Package Management" />
10
<link rel="prev" href="package-management-introduction.html" title="Introduction" />
11
<link rel="next" href="apt-get.html" title="Apt-Get" />
12
<link rel="copyright" href="legal.html" title="Credits and License" />
16
<img id="topcap" alt="" src="https://help.ubuntu.com/htdocs/ubuntunew/img/cap-top.png" />
17
<div id="layout" class="container clear-block">
18
<script xmlns="" src="https://ssl.google-analytics.com/urchin.js" type="text/javascript"></script>
19
<script xmlns="" type="text/javascript">
20
_uacct = "UA-1018242-8";
24
<div id="logo-floater">
26
<a href="https://help.ubuntu.com" title="Ubuntu Documentation">
27
<img alt="Ubuntu" id="logo" src="https://help.ubuntu.com/htdocs/ubuntunew/img/logo.png" />
32
<form action="http://www.google.com/cse" id="cse-search-box">
34
<input type="hidden" name="cx" value="003883529982892832976:e2vwumte3fq" />
35
<input type="hidden" name="ie" value="UTF-8" />
36
<input type="text" name="q" size="27" />
37
<input type="submit" name="sa" value="Search" />
42
document.write('<form action="https://help.ubuntu.com/search.html" id="cse-search-box">');
43
document.write(' <div>');
44
document.write(' <input type="hidden" name="cof" value="FORID:9" />');
45
document.write(' <input type="hidden" name="cx" value="003883529982892832976:e2vwumte3fq" />');
46
document.write(' <input type="hidden" name="ie" value="UTF-8" />');
47
document.write(' <input type="text" name="q" size="27" />');
48
document.write(' <input type="submit" name="sa" value="Search" />');
49
document.write(' </div>');
50
document.write('</form>');
53
<a href="https://help.ubuntu.com/">
54
<img alt="Official Documentation" src="https://help.ubuntu.com/htdocs/ubuntunew/img/help-about.png" />
55
<span>Official Documentation</span>
61
<div class="breadcrumbs"><a href="https://help.ubuntu.com/">Ubuntu Documentation</a> > <a href="https://help.ubuntu.com/11.04">Ubuntu 11.04</a> > <span class="breadcrumb-link"><a href="index.html">Ubuntu Server Guide</a></span> > <span class="breadcrumb-link"><a href="package-management.html">Package Management</a></span> > <span class="breadcrumb-node">dpkg</span></div>
62
<div xmlns="http://www.w3.org/1999/xhtml" class="sect1" title="dpkg">
63
<div class="titlepage">
66
<h2 class="title" style="clear: both"><a id="dpkg"></a>dpkg</h2>
71
<span class="application"><strong>dpkg</strong></span> is a package manager for <span class="emphasis"><em>Debian</em></span> based systems. It can install, remove, and build packages, but
72
unlike other package management system's, it can not automatically download and install packages or their dependencies. This section covers using
73
<span class="application"><strong>dpkg</strong></span> to manage locally installed packages:
75
<div class="itemizedlist">
76
<ul class="itemizedlist" type="disc">
79
To list all packages installed on the system, from a terminal prompt enter:
82
<span class="command"><strong>dpkg -l</strong></span>
87
Depending on the amount of packages on your system, this can generate a large amount of output. Pipe the output through
88
<span class="application"><strong>grep</strong></span> to see if a specific package is installed:
91
<span class="command"><strong>dpkg -l | grep apache2</strong></span>
94
Replace <span class="emphasis"><em>apache2</em></span> with any package name, part of a package name, or other regular expression.
99
To list the files installed by a package, in this case the <span class="application"><strong>ufw</strong></span> package, enter:
102
<span class="command"><strong>dpkg -L ufw</strong></span>
105
<li class="listitem">
107
If you are not sure which package installed a file, <span class="application"><strong>dpkg -S</strong></span> may be able to tell you.
111
<span class="command"><strong>dpkg -S /etc/host.conf </strong></span>
112
<code class="computeroutput">base-files: /etc/host.conf</code>
115
The output shows that the <code class="filename">/etc/host.conf</code> belongs to the <span class="application"><strong>base-files</strong></span> package.
117
<div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
118
<table border="0" summary="Note">
120
<td rowspan="2" align="center" valign="top" width="25">
121
<img alt="[Note]" src="../../libs/admon/note.png" />
123
<th align="left"></th>
126
<td align="left" valign="top">
128
Many files are automatically generated during the package install process, and even though they are on the filesystem
129
<span class="command"><strong>dpkg -S</strong></span> may not know which package they belong to.
136
<li class="listitem">
138
You can install a local <span class="emphasis"><em>.deb</em></span> file by entering:
141
<span class="command"><strong>sudo dpkg -i zip_2.32-1_i386.deb</strong></span>
144
Change <code class="filename">zip_2.32-1_i386.deb</code> to the actual file name of the local .deb file.
147
<li class="listitem">
149
Uninstalling a package can be accomplished by:
152
<span class="command"><strong>sudo dpkg -r zip</strong></span>
154
<div class="caution" title="Caution" style="margin-left: 0.5in; margin-right: 0.5in;">
155
<table border="0" summary="Caution">
157
<td rowspan="2" align="center" valign="top" width="25">
158
<img alt="[Caution]" src="../../libs/admon/caution.png" />
160
<th align="left"></th>
163
<td align="left" valign="top">
165
Uninstalling packages using <span class="application"><strong>dpkg</strong></span>, in most cases, is <span class="emphasis"><em>NOT</em></span> recommended.
166
It is better to use a package manager that handles dependencies, to ensure that the system is in a consistent state. For
167
example using <span class="command"><strong>dpkg -r</strong></span> you can remove the <span class="application"><strong>zip</strong></span> package, but any packages that
168
depend on it will still be installed and may no longer function correctly.
178
For more <span class="application"><strong>dpkg</strong></span> options see the man page: <span class="command"><strong>man dpkg</strong></span>.
182
<div xmlns="http://www.w3.org/1999/xhtml" class="navfooter">
184
<table width="100%" summary="Navigation footer">
186
<td width="40%" align="left"><a accesskey="p" href="package-management-introduction.html"><img src="../../libs/navig/prev.png" alt="Prev" /></a> </td>
187
<td width="20%" align="center">
188
<a accesskey="u" href="package-management.html">
189
<img src="../../libs/navig/up.png" alt="Up" />
192
<td width="40%" align="right"> <a accesskey="n" href="apt-get.html"><img src="../../libs/navig/next.png" alt="Next" /></a></td>
195
<td width="40%" align="left" valign="top">Introduction </td>
196
<td width="20%" align="center">
197
<a accesskey="h" href="index.html">
198
<img src="../../libs/navig/home.png" alt="Home" />
201
<td width="40%" align="right" valign="top"> Apt-Get</td>
207
<div id="ubuntulinks">
208
<p>The material in this document is available under a free license, see <a href="/legal.html">Legal</a> for details<br />
209
For information on contributing see the <a href="https://wiki.ubuntu.com/DocumentationTeam">Ubuntu Documentation Team wiki page</a>. To report a problem, visit the <a href="https://bugs.launchpad.net/ubuntu/+source/ubuntu-docs">bug page for Ubuntu Documentation</a></p>
213
<img src="https://help.ubuntu.com/htdocs/ubuntunew/img/cap-bottom.png" alt="" />