dpkg 命令常用格式如下:
sudo dpkg -i fakeroot.deb
#安装fakeroot.deb软件包(其中-i等价于--install)
sudo dpkg -I fakeroot.deb
#查看fakeroot.deb软件包的详细信息,包括软件名称、版本以及大小等(其中-I等价于--info)
sudo dpkg -c fakeroot.deb
#查看fakeroot.deb软件包中包含的文件结构(其中-c等价于--contents)
sudo dpkg -l fakeroot.deb
#查看fakeroot软件包的信息(软件名称可通过dpkg -I命令查看,其中-l等价于--list)
sudo dpkg -L fakeroot
#查看fakeroot软件包安装的所有文件(软件名称可通过dpkg -I命令查看,其中-L等价于--listfiles)
sudo dpkg -s fakeroot
#查看fakeroot软件包的详细信息(软件名称可通过dpkg -I命令查看,其中-s等价于--status)
sudo dpkg -r fakeroot
# 卸载fakeroot软件包(软件名称可通过dpkg -I命令查看,其中-r等价于--remove)
-r,--remove,-P,--purge package...|-a|--pending #Remove an installed package.
-r or --remove remove everything except conffiles. This mayavoid having to reconfigure the package if it is reinstalled later. (Conffiles are configuration files that are listed in the DEBIAN/conffiles control file).
-P or --purge removeseverything,including conffiles. If -a or --pending is given instead of a package name,thenall packages unpacked,but marked to be removed or purged in file /var/lib/dpkg/status,areremoved or purged,respectively.
Note: some configuration files might be unknown to dpkgbecause they are created and handled separately through the configuration scripts. In thatcase,dpkg won't remove them by itself,but the package's postrm script (which is called bydpkg),has to take care of their removal during purge. Of course,this only applies to filesin system directories,not configuration files written to individual users' home directories.
Removing of a package consists of the following steps:
1. Run prerm script
2. Remove the installed files
3. Run postrm script
Note:deb 是debian linus的安装格式,跟 red hat 的rpm非常相似,最基本的安装命令是:dpkg -i file.deb或者直接双击此文件,dpkg命令无法自动解决依赖关系,如果安装的deb包存在依赖包,则应避免使用此命令,或者按照依赖关系顺序安装依赖包; dpkg 是Debian Package 的简写,是为Debian专门开发的套件管理系统,方便软件的安装、更新及移除。所有源自Debian的Linux发行版都使用dpkg,例如Ubuntu、Knoppix 等。