What is the pkg analog of "apt show"?

pkg info displays full information on the installed packages. How do I get the same output for packages not yet installed? On Ubuntu, apt show does exactly that.

ETA: An example of what I’m looking for, taken from Ubuntu.

$ apt show sudoku
Package: sudoku
Version: 1.0.5-2build2
Priority: optional
Section: universe/games
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Peter Spiess-Knafl <dev@spiessknafl.at>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 124 kB
Depends: libc6 (>= 2.4), libncurses5 (>= 6), libtinfo5 (>= 6)
Homepage: https://github.com/cinemast/sudoku
Download-Size: 41.9 kB
APT-Sources: http://ru.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
Description: console based sudoku
 This sudoku puzzle generator/solver features:
  * character based (curses) interface;
  * cross-platform (Minix, Unix, Windows) with full source code (ANSI C);
  * generates hints upon request;
  * classification of board difficulty (very easy, easy, medium, hard or
  * generation of new boards;
  * easy entry of boards published in newspapers, Internet, ...;
  * multiple output formats (text, csv, HTML, PostScript).
Asked By: sigil


Use pkg rquery [query statements] [package name] to replicate apt show. This forum post is outlining its similarity to apt-cache show. The rquery manpage covers the basics of query commands. An example would be something along the lines of this:

pkg rquery %n:n%o:n%p:n%e pkg

This shows the name of the package (%n), the origin of the package (%o), the prefix of the package (%p), and the description of the package (%e). All of which split on to their own newline (n). There are many options and formats. Please check with the manpage for more specific queries. To get an identical output to apt show you will need to nearly use every option but if you only need to know one or two things you can just query for those.

Answered By: kemotep

For a short equivalent try:

$ pkg search -gfSn ba*le
Name           : bastille
Version        : 0.9.20220216
Origin         : sysutils/bastille
Architecture   : FreeBSD:13:*
Prefix         : /usr/local
Repository     : FreeBSD [pkg+http://pkg.FreeBSD.org/FreeBSD:13:aarch64/quarterly]
Categories     : sysutils
Licenses       : BSD3CLAUSE
Maintainer     : christer.edwards@gmail.com
WWW            : https://bastillebsd.org
Comment        : Jail automation framework
Annotations    :
Flat size      : 247KiB
Pkg size       : 37.4KiB
Description    :
Bastille helps you quickly create and manage FreeBSD Jails.

The project focuses on secure defaults, automation and
repeatable templates.

WWW: https://bastillebsd.org

-g glob pattern for entire search field
-f full information
-Sn search on name

Answered By: bro
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.