Arch Linux pacman 与其他发行版操作比较

原文:https://wiki.archlinux.org/index.php/Pacman/Rosetta
https://old-en.opensuse.org/Software_Management_Command_Line_Comparison

http://dnf.readthedocs.org/en/latest/cli_vs_yum.html

ty co Action 行动 Arch Red Hat/Fedora Debian/Ubuntu SLES/openSUSE Gentoo ty
Basic operations 基本操作 1 Install a package(s) by name 按名称安装软件包 pacman -S dnf install apt install zypper install
zypper in
emerge [-a] Basic operations 基本操作
2 Remove a package(s) by name 按名称删除包 pacman -Rs dnf remove apt remove zypper remove
zypper rm
emerge -C
3 Search for package(s) by searching the expression in name, description, short description. What exact fields are being searched by default varies in each tool. Mostly options bring tools on par. 通过在名称,描述,简短描述中搜索表达式来搜索包。默认搜索的确切字段在每个工具中都有所不同。大多数选项带来了相同的工具。 pacman -Ss dnf search apt search zypper search
zypper se [-s]
emerge -S
4 Upgrade Packages - Install packages which have an older version already installed 升级包 - 安装已安装旧版本的包 pacman -Syu dnf upgrade apt update && apt upgrade zypper update zypper up emerge -u world
5 Upgrade Packages - Another form of the update command, which can perform more complex updates -- like distribution upgrades. When the usual update command will omit package updates, which include changes in dependencies, this command can perform those updates. 升级包 - 另一种形式的更新命令,可以执行更复杂的更新 - 例如分发升级。当通常的更新命令将省略包更新(包括依赖关系的更改)时,此命令可以执行这些更新。 pacman -Syu dnf distro-sync apt update && apt dist-upgrade zypper dup emerge -uDN world
6 Clean up all local caches. Options might limit what is actually cleaned. Autoclean removes only unneeded, obsolete information. 清理所有本地缓存 。选项可能会限制实际清理的内容。 Autoclean仅删除不需要的过时信息。 pacman -Sc
pacman -Scc
dnf clean all apt autoclean
apt clean
zypper clean eclean distfiles
7 Remove dependencies that are no longer needed, because e.g. the package which needed the dependencies was removed. 删除不再需要的依赖项,例如删除了需要依赖项的包。 pacman -Qdtq | pacman -Rs - dnf autoremove apt autoremove zypper rm -u emerge --depclean
8 Remove packages no longer included in any repositories. 删除不再包含在任何存储库中的包。 pacman -Qmq | pacman -Rs - dnf repoquery --extras aptitude purge '~o'    
9 Mark a package previously installed as a dependency as explicitly required. 将先前作为依赖项安装的包标记为明确要求。 pacman -D --asexplicit dnf mark install apt-mark manual   emerge --select
10 Install package(s) as dependency / without marking as explicitly required. 安装包作为依赖/没有明确要求的标记。 pacman -S --asdeps dnf install => dnf mark remove apt-mark auto   emerge -1
11 Only downloads the given package(s) without unpacking or installing them 仅下载给定的软件包而无需解压缩或安装它们 pacman -Sw dnf download apt install --download-only (into the package cache)
apt download (bypass the package cache)
zypper --download-only emerge --fetchonly
12 Start a shell to enter multiple commands in one session 启动shell以在一个会话中输入多个命令     apt-config shell zypper shell  
13 Show a log of actions taken by the software management. 显示软件管理所采取的操作的日志。 cat /var/log/pacman.log dnf history cat /var/log/dpkg.log cat /var/log/zypp/history located in /var/log/portage
14 Get a dump of the whole system information - Prints, Saves or similar the current state of the package management system. Preferred output is text or XML. (Note: Why either-or here? No tool offers the option to choose the output format.) 获取整个系统信息的转储 - 打印,保存或类似包管理系统的当前状态。首选输出是文本或XML。 (注意:为什么或者在这里?没有工具提供选择输出格式的选项。) (see /var/lib/pacman/local) (see /var/lib/rpm/Packages) apt-cache stats n/a emerge --info
15 e-mail delivery of package changes 电子邮件传递包更改     apt install apt-listchanges    
                   
Querying specific packages 查询特定包 1 Show all or most information about a package. The tools' verbosity for the default command vary. But with options, the tools are on par with each other. 显示有关包的所有或大部分信息。 工具对默认命令的详细程度各不相同。 但是通过选项,这些工具彼此相同。 pacman -[S|Q]i dnf list, dnf info apt show / apt-cache policy zypper info zypper if emerge -S; emerge -pv; eix Querying specific packages 查询特定包
2 Display local package information: Name, version, description, etc. 显示本地包信息:名称,版本,描述等。 pacman -Qi rpm -qi / dnf info installed dpkg -s / aptitude show zypper info; rpm -qi emerge -pv and emerge -S
3 Display remote package information: Name, version, description, etc. 显示远程包信息:名称,版本,描述等。 pacman -Si dnf info apt-cache show / aptitude show zypper info emerge -pv and emerge -S or equery m (meta)
4 Display files provided by local package 显示本地包提供的文件 pacman -Ql rpm -ql dpkg -L rpm -Ql equery files
5 Display files provided by a remote package 显示远程包提供的文件 pacman -Fl dnf repoquery -l or repoquery -l (from package yum-utils) apt-file list $pattern   pfl
6 Query the package which provides FILE 查询提供FILE的包 pacman -Qo rpm -qf (installed only) or dnf provides (everything) or repoquery -f (from package yum-utils) dpkg -S / dlocate zypper search -f equery belongs
7 List the files that the package holds. Again, this functionality can be mimicked by other more complex commands. 列出程序包包含的文件。 同样,此功能可以通过其他更复杂的命令来模仿。 pacman -Ql 
pacman -Fl
dnf repoquery -l dpkg-query -L rpm -ql equery files
8 Displays packages which provide the given exp. aka reverse provides. Mainly a shortcut to search a specific field. Other tools might offer this functionality through the search command. 显示提供给定exp的包。 又名反向提供。 主要是搜索特定字段的快捷方式。 其他工具可能通过搜索命令提供此功能。 pacman -Fo dnf provides apt-file search zypper what-provides zypper wp equery belongs (only installed packages); pfl
9 Search all packages to find the one which holds the specified file. auto-apt is using this functionality. 搜索所有包以查找包含指定文件的包。 auto-apt正在使用此功能。 pacman -Fs dnf provides apt-file search zypper search -f equery belongs
10 Show the changelog of a package 显示包的更改日志 pacman -Qc rpm -q --changelog apt-get changelog rpm -q --changelog equery changes -f
                   
Querying package lists 查询包列表 1 Search for package(s) by searching the expression in name, description, short description. What exact fields are being searched by default varies in each tool. Mostly options bring tools on par. 通过在名称,描述,简短描述中搜索表达式来搜索包。默认搜索的确切字段在每个工具中都有所不同。大多数选项带来了相同的工具。 pacman -Ss dnf search apt search zypper search zypper se [-s] emerge -S Querying package lists 查询包列表
2 Lists packages which have an update available. Note: Some provide special commands to limit the output to certain installation sources, others use options. 列出具有可用更新的包。注意:有些命令提供特殊命令来限制输出到某些安装源,其他命令则使用选项。 pacman -Qu dnf list updates, dnf check-update apt-get upgrade -> n zypper list-updates zypper patch-check (just for patches) emerge -uDNp world
3 Display a list of all packages in all installation sources that are handled by the packages management. Some tools provide options or additional commands to limit the output to a specific installation source. 显示由包管理处理的所有安装源中的所有包的列表。某些工具提供选项或其他命令以限制输出到特定安装源。 pacman -Sl dnf list available apt-cache dumpavail apt-cache dump (Cache only) apt-cache pkgnames zypper packages emerge -ep world
4 Generates a list of installed packages 生成已安装包的列表 pacman -Q dnf list installed dpkg --list | grep ^i zypper search --installed-only emerge -ep world
5 List packages that are installed but are not available in any installation source (anymore). 列出已安装但在任何安装源(不再)中都不可用的软件包。 pacman -Qm dnf list extras deborphan zypper se -si | grep 'System Packages' eix-test-obsolete
6 List packages that were recently added to one of the installation sources, i.e. which are new to it. 列出最近添加到其中一个安装源的软件包,即新的安装源。 (none) dnf list recent aptitude search '~N' / aptitude forget-new n/a eix-diff
7 List installed local packages along with version 列出已安装的本地软件包以及版本 pacman -Q rpm -qa dpkg -l zypper search -s; rpm -qa emerge -e world
8 Search locally installed package for names or descriptions 在本地安装的包中搜索名称或描述 pacman -Qs rpm -qa '*<str>*' aptitude search '~i(~n $name|~d $description)'   eix -S -I
9 List packages not required by any other package 列出任何其他包不需要的包 pacman -Qt package-cleanup --all --leaves deborphan -anp1    
10 List packages installed explicitly (not as dependencies) 列出明确安装的包(不是依赖项) pacman -Qe dnf history userinstalled apt-mark showmanual    
11 List packages installed automatically (as dependencies) 列出自动安装的包(作为依赖项) pacman -Qd   apt-mark showauto    
                   
Querying package dependencies 查询包依赖项 1 Display packages which require X to be installed, aka show reverse dependencies. 显示需要安装X的软件包,也就是显示反向依赖项。 pacman -Sii dnf repoquery --alldeps --whatrequires or repoquery --whatr[equires] apt-cache rdepends / aptitude search ~D$pattern zypper search --requires equery depends Querying package dependencies 查询包依赖项
2 Display packages which conflict with given expression (often package). Search can be used as well to mimic this function. 显示与给定表达式(通常是包)冲突的包。 也可以使用搜索来模仿此功能。   dnf repoquery --conflicts aptitude search '~C$pattern'    
3 List all packages which are required for the given package, aka show dependencies. 列出给定包所需的所有包,即show dependencies。 pacman -[S|Q]i dnf repoquery --requires or repoquery -R apt-cache depends / apt-cache show zypper info --requires emerge -ep
4 List what the current package provides 列出当前包提供的内容   dnf provides dpkg -s / aptitude show zypper info --provides equery files
5 List all packages that require a particular package 列出需要特定包的所有包   dnf repoquery --alldeps --whatrequires aptitude search ~D{depends,recommends,suggests}:$pattern / aptitude why zypper search --requires equery depends -a
6 Display all packages that the specified packages obsoletes. 显示指定包废弃的所有包。   dnf list obsoletes apt-cache show    
7 Generates an output suitable for processing with dotty for the given package(s). 生成适合于使用dotty处理给定包的输出。     apt-cache dotty n/a  
                   
Installation sources management 安装源管理 1 Installation sources management 安装源管理 ${EDITOR} /etc/pacman.conf ${EDITOR} /etc/yum.repos.d/${REPO}.repo ${EDITOR} /etc/apt/sources.list ${EDITOR} /etc/zypp/repos.d/${REPO}.repo layman Installation sources management 安装源管理
2 Add an installation source to the system. Some tools provide additional commands for certain sources, others allow all types of source URI for the add command. Again others, like apt and dnf force editing a sources list. apt-cdrom is a special command, which offers special options design for CDs/DVDs as source. 将安装源添加到系统。 某些工具为某些源提供附加命令,其他工具允许add命令的所有类型的源URI。 其他人,比如apt和dnf强制编辑源列表。 apt-cdrom是一个特殊的命令,它提供CD / DVD的特殊选项设计作为源。 /etc/pacman.conf /etc/yum.repos.d/*.repo apt-cdrom add zypper service-add layman, overlays
3 Refresh the information about the specified installation source(s) or all installation sources. 刷新有关指定安装源或所有安装源的信息。 pacman -Sy (always upgrade the whole system afterwards) dnf clean expire-cache && dnf check-update apt-get update zypper refresh zypper ref emerge --sync;layman -S
4 Prints a list of all installation sources including important information like URI, alias etc. 打印所有安装源的列表,包括URI,别名等重要信息。 cat /etc/pacman.d/mirrorlist cat /etc/yum.repos.d/* apt-cache policy zypper service-list layman -l
5 List all packages from a certain repo 列出某个仓库中的所有包裹 paclist <repo>        
6 Disable an installation source for an operation 禁用操作的安装源   dnf --disablerepo=     emerge package::repo-to-use
7 Download packages from a different version of the distribution than the one installed. 从分发版本的不同版本下载软件包。   dnf --releasever= apt-get install -t release package/ apt-get install package/release (deps not covered)   echo "category/package ~amd64" >> /etc/portage/package.keywords && emerge package
                   
Overrides 覆盖 1 Add a package lock rule to keep its current state from being changed 添加程序包锁定规则以防止其当前状态发生更改 /etc/pacman.conf
modify IgnorePkg array
dnf.conf <--”exclude” option (add/amend) apt-mark hold pkg Put package name in /etc/zypp/locks, or zypper al /etc/portage/package.mask Overrides 覆盖
2 Delete a package lock rule 删除包锁定规则 remove package from IgnorePkg line in /etc/pacman.conf   apt-mark unhold pkg Remove package name from /etc/zypp/locks or zypper rl /etc/portage/package.mask (or package.unmask)
3 Show a listing of all lock rules 显示所有锁定规则的列表 cat /etc/pacman.conf   /etc/apt/preferences View /etc/zypp/locks or zypper ll cat /etc/portage/package.mask
4 Set the priority of the given package to avoid upgrade, force downgrade or to overwrite any default behavior. Can also be used to prefer a package version from a certain installation source. 设置给定包的优先级以避免升级,强制降级或覆盖任何默认行为。 也可用于优先选择某个安装源的软件包版本。 ${EDITOR} /etc/pacman.conf
Modify HoldPkg and/or IgnorePkg arrays
  /etc/apt/preferences, apt-cache policy zypper mr -p ${EDITOR} /etc/portage/package.keywords
Add a line with =category/package-version
5 Remove a previously set priority 删除先前设置的优先级     /etc/apt/preferences zypper mr -p ${EDITOR} /etc/portage/package.keywords
remove offending line
6 Show a list of set priorities. 显示设置优先级列表。     apt-cache policy /etc/apt/preferences zypper lr -p cat /etc/portage/package.keywords
7 Ignores problems that priorities may trigger. 忽略优先级可能触发的问题。       n/a  
                   
Verification and repair 验证和修复 1 Verify single package 验证单个包 pacman -Qk[k] rpm -V debsums rpm -V equery check Verification and repair 验证和修复
2 Verify all packages 验证所有包 pacman -Qk[k] rpm -Va debsums rpm -Va equery check
3 Reinstall given Package - Will reinstall the given package without dependency hassle. 重新安装给定的包 - 将重新安装给定的包没有依赖性麻烦。 pacman -S dnf reinstall apt install --reinstall zypper install --force emerge -1O
4 Verify dependencies of the complete system. Used if installation process was forcefully killed. 验证整个系统的依赖关系。 如果强制终止安装过程,则使用。 pacman -Dk dnf repoquery --requires apt-get check zypper verify emerge -uDN world
5 Use some magic to fix broken dependencies in a system 使用一些魔法来修复系统中破坏的依赖项 pacman dep level - pacman -Dk, shared lib level - findbrokenpkgs or lddd dnf repoquery --unsatisfied apt-get --fix-broken
aptitude install
zypper verify revdep-rebuild
6 Add a checkpoint to the package system for later rollback 将检查点添加到包系统以便以后回滚   (unnecessary, done on every transaction)   n/a  
7 Remove a checkpoint from the system 从系统中删除检查点 N/A N/A   n/a  
8 Provide a list of all system checkpoints 提供所有系统检查点的列表 N/A dnf history list   n/a  
9 Rolls entire packages back to a certain date or checkpoint. 将整个包裹卷回特定日期或检查点。 N/A dnf history rollback   n/a  
10 Undo a single specified transaction. 撤消单个指定的事务。 N/A dnf history undo   n/a  
                   
Using package files and building packages 使用包文件和构建包 1 Query a package supplied on the command line rather than an entry in the package management database 查询命令行上提供的包而不是包管理数据库中的条目 pacman -Qp rpm -qp dpkg -I     Using package files and building packages 使用包文件和构建包
2 List the contents of a package file 列出包文件的内容 pacman -Qpl rpmls rpm -qpl dpkg -c rpm -qpl  
3 Installs local package file, e.g. app.rpm and uses the installation sources to resolve dependencies 安装本地包文件,例如 app.rpm并使用安装源来解决依赖关系 pacman -U dnf install apt install zypper in emerge
4 Updates package(s) with local packages and uses the installation sources to resolve dependencies 使用本地软件包更新软件包,并使用安装源来解决依赖关系 pacman -U dnf upgrade debi   emerge
5 Add a local package to the local package cache mostly for debugging purposes. 将本地程序包添加到本地程序包高速缓存主要用于调试目的。 cp $filename /var/cache/pacman/pkg/   apt-cache add n/a cp $filename /usr/portage/distfiles
6 Extract a package 提取包 tar -Jxvf rpm2cpio | cpio -vid dpkg-deb -x rpm2cpio | cpio -vid tar -jxvf
7 Install/Remove packages to satisfy build-dependencies. Uses information in the source package. 安装/删除包以满足构建依赖性。 使用源包中的信息。 automatic dnf builddep apt-get build-dep zypper si -d emerge -o
8 Display the source package to the given package name(s) 将源包显示给给定的包名称   dnf repoquery -s apt-cache showsrc n/a  
9 Downloads the corresponding source package(s) to the given package name(s) 将相应的源包下载到给定的包名称 Use ABS && makepkg -o dnf download --source apt-get source / debcheckout zypper source-install emerge --fetchonly
10 Build a package 构建一个包 makepkg -s rpmbuild -ba (normal)
mock (in chroot)
debuild rpmbuild -ba; build; osc build ebuild; quickpkg
11 Check for possible packaging issues 检查可能的包装问题 namcap rpmlint lintian rpmlint repoman
上一篇:pacman详解及常见问题


下一篇:Sublime Text3 个人使用心得