Comparing the pkg search and pkg contents Commands

Like the pkg contents command, the pkg search command examines the contents of packages. While the pkg contents command returns the contents, the pkg search command returns the names of packages that match the search query. The following table shows some of the similarities and differences between these two commands.

Table 2-1 pkg search and pkg contents Comparison

pkg search pkg contents
  • Searches packages in repositories associated with all publishers configured for this image. Use the -l option to search only installed packages.

  • Use the -s option to specify the URI of a repository to search.

  • Use the search query to specify an action.

  • Use the search query to specify an attribute and attribute value.

  • Use the -o option to specify columns of results.

  • Examines installed packages. Use the -r option to examine packages in repositories associated with all publishers configured for this image.

  • Use the -g option to specify the URI of a repository to examine.

  • Use the -t option to specify an action.

  • Use the -a option to specify an attribute and attribute value.

  • Use the -o option to specify columns of results.

  • Use the -s option to sort the results.

Tip:

Use the pkg contents command to show the contents of a specified package, and use the pkg search command to show packages that match a query. If you know which package delivers the content that you are interested in, use the pkg contents command.