清理不再需要的软件包
类似于 apt autoremove
:
$ pacman -Qtdq | sudo pacman -Rns -
How to remove orphaned unused packages in Arch Linux
https://www.cyberciti.biz/faq/delete-remove-orphaned-unused-packages-arch-linux-pacman-command/
根据文件名查找软件包
先更新文件数据库,类似于 apt-file update
, yum updateinfo
:
$ sudo pacman -Fy
类似于 apt-file search
, yum provides
:
$ pacman -F libgstqmlgl.so
extra/gst-plugin-qmlgl 1.22.1-2
usr/lib/gstreamer-1.0/libgstqmlgl.so
使用正则表达式:
$ pacman -Fx libgstqml
extra/gst-plugin-qml6 1.22.1-2
usr/lib/gstreamer-1.0/libgstqml6.so
extra/gst-plugin-qmlgl 1.22.1-2 [installed]
usr/lib/gstreamer-1.0/libgstqmlgl.so
根据关键字搜索软件包
类似于 apt search
, yum search
$ pacman -Ss gst-plugin-qml
extra/gst-plugin-qml6 1.22.1-2
Multimedia graph framework - qml6 plugin
extra/gst-plugin-qmlgl 1.22.1-2 [installed]
Multimedia graph framework - qmlgl plugin
查看软件包信息
类似于 apt show
, yum info
$ pacman -Si gst-libav
Repository : extra
Name : gst-libav
Version : 1.22.1-2
Description : Multimedia graph framework - libav plugin
列出软件包中文件
$ pacman -Fl zsh
zsh etc/
zsh etc/zsh/
zsh etc/zsh/zprofile
zsh usr/
zsh usr/bin/
zsh usr/bin/zsh
查看本地未安装软件安装包信息
类似于 dpkg -I
, rpm -qpi
$ pacman -Qpi gst-libav-1.22.2-1-x86_64.pkg.tar.zst
Name : gst-libav
Version : 1.22.2-1
Description : Multimedia graph framework - libav plugin
列出本地未安装软件包中文件
类似于 dpkg -c
, rpm -qpl
$ pacman -Qpl ./gst-plugin-qmlgl-1.22.2-1-x86_64.pkg.tar.zst
gst-plugin-qmlgl /usr/
gst-plugin-qmlgl /usr/lib/
gst-plugin-qmlgl /usr/lib/gstreamer-1.0/
gst-plugin-qmlgl /usr/lib/gstreamer-1.0/libgstqmlgl.so
列出本地已安装软件包
类似于 dpkg -l
, rpm -qa
$ pacman -Q | grep glib2
glib2 2.76.1-1
列出本地已安装软件包中文件
类似于 dpkg -L
, rpm -ql
$ pacman -Ql gst-plugin-qmlgl
gst-plugin-qmlgl /usr/
gst-plugin-qmlgl /usr/lib/
gst-plugin-qmlgl /usr/lib/gstreamer-1.0/
gst-plugin-qmlgl /usr/lib/gstreamer-1.0/libgstqmlgl.so
下载软件包但不安装
$ sudo pacman -Sw gst-libav
$ ls /var/cache/pacman/pkg/
gst-libav-1.22.1-2-x86_64.pkg.tar.zst gst-libav-1.22.1-2-x86_64.pkg.tar.zst.sig
安装本地软件包
类似于 dpkg -i
, rpm -Uvh
$ sudo pacman -U gst-libav-1.22.1-2-x86_64.pkg.tar.zst
根据本地文件路径查找所属软件包
类似于 dpkg -S
, rpm -qf
$ pacman -Qo /usr/lib/gstreamer-1.0/libgstqmlgl.so
/usr/lib/gstreamer-1.0/libgstqmlgl.so is owned by gst-plugin-qmlgl 1.22.1-2
解压软件包
类似于 dpkg -x
, rpm2cpio | cpio -div
$ tar xf gst-libav-1.22.2-1-x86_64.pkg.tar.zst
$ for i in $(ls *.pkg.tar.zst); do tar -xf $i -C ../built; done
参考资料
Pacman queries the local package database with the
-Q
flag, the sync database with the-S
flag and the files database with the-F
flag. Seepacman -Qh
,pacman -Sh
andpacman -Fh
for the respective suboptions of each flag.
Querying package databases
https://wiki.archlinux.org/title/Pacman#Querying_package_databases
In Arch Linux how can I find out which package to install that will contain file X?
https://unix.stackexchange.com/questions/14858/in-arch-linux-how-can-i-find-out-which-package-to-install-that-will-contain-file
最后修改于 2023-07-08