Linux各主要发行版的包管理命令对照
Debian使用的是apt和dpkg,Gentoo则用的是emerge,Redhat的yum、Suse的zypper、Arch的pacman、Slackware的slackpkg。
更新源:
# apt-get update
# emerge --sync
# yum check-update
# zypper refresh
# pacman -Sy
# slackpkg update
# emerge --sync
# yum check-update
# zypper refresh
# pacman -Sy
# slackpkg update
搜索包:
# apt-cache search
# emerge --search
# yum search
# zypper search
# pacman -Qs
# slackpkg search
# emerge --search
# yum search
# zypper search
# pacman -Qs
# slackpkg search
查看包的详细信息:
# apt-cache show
# emerge -udpv
# yum info
# zypper info
# pacman -Qi
# --
# emerge -udpv
# yum info
# zypper info
# pacman -Qi
# --
显示依赖关系:
# apt-cache depends
# emerge --emptytree --pretend
# yum deplist
# --
# --
# --
# emerge --emptytree --pretend
# yum deplist
# --
# --
# --
安装包:
# apt-get install
# emerge
# yum install
# zypper install
# pacman -S
# slackpkg install
# emerge
# yum install
# zypper install
# pacman -S
# slackpkg install
删除包:
# apt-get remove
# emerge --unmerge
# yum erase
# zypper remove
# pacman -R
# slackpkg remove
# emerge --unmerge
# yum erase
# zypper remove
# pacman -R
# slackpkg remove
显示可用更新:
# apt-get upgrade -> n
# --
# yum list updates
# zypper list-updates
# --
# --
# --
# yum list updates
# zypper list-updates
# --
# --
更新全部已安装的包:
# apt-get upgrade
# emerge -Nua world
# yum update
# zypper update
# pacman -Su
# slackpkg update-all
# emerge -Nua world
# yum update
# zypper update
# pacman -Su
# slackpkg update-all
更新整个系统:
# apt-get dist-upgrade
# emerge -NuDa world
# yum upgrade
# zypper dup
# --
# --
# emerge -NuDa world
# yum upgrade
# zypper dup
# --
# --
列出已安装的包:
# dpkg -l
# equery l (需要安装gentoolkit)
# rpm -qa
# rpm -qa
# pacman -Qii
# ls /var/log/packages/
# equery l (需要安装gentoolkit)
# rpm -qa
# rpm -qa
# pacman -Qii
# ls /var/log/packages/
删除缓存中的旧包:
# apt-get clean
# rm -r /usr/portage/distfiles
# yum clean
# --
# --
# --
# rm -r /usr/portage/distfiles
# yum clean
# --
# --
# --
删除不需要的依赖关系:
# apt-get autoremove
# emerge --depclean
# --
# --
# --
# --
# emerge --depclean
# --
# --
# --
# --