红联Linux门户
Linux帮助
当前位置: 红联Linux门户 > Debian

dpkg,apt差别

发布时间:2008-09-17 11:07:09来源:红联作者:mxjqcg
dpkg是用来安装.deb文件,但不会解决模块的依赖关系,且不会关心ubuntu的软件仓库内的软件,可以用于安装本地的deb文件

apt会解决和安装模块的依赖问题,并会咨询软件仓库, 但不会安装本地的deb文件, apt是建立在dpkg之上的软件管理工具

sudo apt-get update Consults /etc/apt/sources.list
and updates the database of available
packages. Be sure to run this command
whenever sources.list is changed.
apt-cache search Case-insensitive search of the package
database for the keyword given. The
package names and descriptions are
returned where that keyword is found.
sudo apt-get install Download and install the given package
name as found in the package database.
Starting with APT version 0.6, this
command will automatically verify
package authenticity for gpg keys it
knows about (http://wiki.debian
.org/SecureApt).

sudo apt-get -d install Download the package only, placing it
in /var/cache/apt/archives.
apt-cache show Display information about the software
from the named package.
sudo apt-get upgrade Check updates for all installed packages
and then prompt to download
and install them.
sudo apt-get dist-upgrade Updates the entire system to a new
release, even if it means removing
packages. Note: This is not the preferred
method for updating a system.
sudo apt-get autoclean Can be run anytime to delete partially
downloaded packages, or packages
no longer installed.
sudo apt-get clean Removes all cached packages from
/var/cache/apt/archives to
free up disk space.
sudo apt-get --purge remove Remove the named package and all
its configuration files. Remove the
--purge keyword to keep config
files.
sudo apt-get -f install Do a sanity check for broken packages.
This tries to fix any “unmet
dependency” messages.
apt-config -V Print version information of installed
APT utilities.
sudo apt-key list List gpg keys that APT knows about.
apt-cache stats Print statistics on all packages
installed.
apt-cache depends Print dependencies for a package
(whether it’s installed or not).
apt-cache pkgnames List all packages installed on the
system.


dpkg -c <.deb file> Lists files which are installed by the
.deb file given (.deb file must be
path/filename).
dpkg -I <.deb file> Lists information about the .deb
given file.
dpkg -p Lists information about the package.
dkpg -S Lists the packages where the given
file name is found. This can be a path,
or just the name of a file.

dpkg -l Lists installed packages. This will also
take options for more specific info.
dpkg -L Lists all the files which have been
installed from package (package must
have been previously installed).
dpkg -s Lists the status of the given package.
sudo dpkg -i <.deb file> Installs the given .deb file.
sudo dpkg -r Removes the given package from the
system, but leaves files behind.
sudo dpkg -P Removes package and config files of
given package.
sudo dpkg -x <.deb file> Extracts the files contained in the
.deb file to a destination directory.
Note that this will reset permissions
on the target directory.
文章评论

共有 2 条评论

  1. aqq5220 于 2010-01-18 09:37:07发表:

    安装软件就用apt
    安装本地软件用dpkg,有依赖就用apt查一下!然后一个一个下载,慢慢折腾!
    心情不好直接gdebi!
    偶新人一个!高手请指教!

  2. lijiang 于 2010-01-16 22:54:07发表:

    dpkg是用来安装.deb文件,但不会解决模块的依赖关系,且不会关心ubuntu的软件仓库内的软件,可以用于安装本地的deb文件

    apt会解决和安装模块的依赖问题,并会咨询软件仓库, 但不会安装本地的deb文件, apt是建立在dpkg之上的软件管理工具
    -正好解决我的问题