I'm using pacman 5.0.1 on Arch Linux and I'd like to get information about packages installed on my machine as well as packages in the remote repositories.
Information should include a description of the package, its size, and its build date.
I'm using pacman 5.0.1 on Arch Linux and I'd like to get information about packages installed on my machine as well as packages in the remote repositories.
Information should include a description of the package, its size, and its build date.
--infoTaking vi as an example, to get information about its locally installed package use
pacman -Q --info vi This produces
Name : vi Version : 1:070224-2 Description : The original ex/vi text editor Architecture : x86_64 URL : http://ex-vi.sourceforge.net/ Licenses : custom:ex Groups : base Provides : None Depends On : ncurses Optional Deps : s-nail: used by the preserve command for notification [installed] Required By : None Optional For : None Conflicts With : None Replaces : None Installed Size : 290.00 KiB Packager : Evangelos Foutras <[email protected]> Build Date : Sun 06 Sep 2015 09:34:15 PM CEST Install Date : Mon 03 Oct 2016 07:18:13 PM CEST Install Reason : Explicitly installed Install Script : No Validated By : Signature Alternatively use the shorter -i option:
pacman -Qi vi To only get the value of a specific package property, let's say the description, there's good old grep to filter the output:
pacman -Qi vi | grep -Po '^Description\s*: \K.+' Which prints
The original ex/vi text editor
A short explanation of the grep command above:
-P activates Perl-compatible regular expressions-o print only the matched parts of a matching line, not the whole line^Description\s*: \K.+ is the regex: The line must start with "Description" followed by any number of whitespace characters, followed by ": ". Then: \K resets the starting point of the match. The matched characters starting with "Description" are not included in the final match.+ matches everything afterwards, which is the package descriptionHere's a general answer on how to remove known prefixes from lines.
Getting information from the remote repository works similar:
pacman -Si vi When you only know parts of the package's name, use the -s option:
pacman -Ss jdk To find out which packages depend on a certain package — for example if you're wondering why a package exists on your system — you can use pactree:
pactree -r intel-media-driver which produces a nice dependency tree:
intel-media-driver └─intel-media-sdk └─ffmpeg ├─electron6 │ └─code ├─firefox ├─freerdp │ └─wlroots │ └─sway ├─qt5-webengine │ └─python2-pyqtwebengine │ └─calibre ├─unpaper │ └─ocrmypdf ├─vlc └─wf-recorder-git Combining the previous commands with fzf allows for a minimal textual package browser.
For local packages:
cmd='(pacman -Qi {}; pactree -r {})'; pacman -Q --quiet | fzf --preview "$cmd" For remote packages:
cmd='pacman -Si {2}'; pacman -S --list | fzf --preview "$cmd" You can scroll the preview with Shift+↑ and Shift+↓.
To open the preview in your editor with Enter, change the command to:
fzf --preview "$cmd" --bind "enter:execute($EDITOR <($cmd))" Here the contents of the preview are passed to your editor using process substitution.
You might also add this to install a remote package with Alt+Enter:
--bind "alt-enter:execute(sudo pacman -S {2})"