portdbc

CRUX’s portdb command line client

portdbc is a command line tool which provides an easy way to query the CRUX’s portdb without the need of use a web browser for that.

It is written in C and uses libcurl(3) for data retrieval and libxml(3) for parsing XML responses.

One of its advantages is that it integrates smoothly with shell tools — you can combine it with pipes, filters, and scripts to automate port searches and maintenance tasks.

Requirements

Installation

Build and install from source:

autoconf
./configure
make
sudo make install

Configuration

Starting with version 1.4, portdbc supports reading configuration from a file, allowing multiple PortDB URLs to be queried automatically.

By default, portdbc looks for a configuration file in: ~/.portdbc.conf.
If not found, it falls back to a system default or the built-in URL.

Example .portdbc.conf:

# ~/.portdbc.conf

# Define one or more PortDB URLs (queried in order)
portdb_url = https://crux.nu/portdb/
portdb_url = https://crux-arm.nu/portdb/

Each portdb_url line adds another source to query.
You can list multiple servers to mirror or extend your repositories.

Usage

portdbc <command> [arg]

Where commands are:
  repos             Overview of all available repositories
  dups              List of duplicated ports
  search  <expr>    Show port names containing 'expr'
  list    <repo>    Show ports in repository
  getup   <repo>    Print httpup/rsync file for a repository
  help              Show this help information
  version           Show version information

See the page manual for more information: portdbc(8)

Examples

Retrieve the sync file from the xfce4 repository:

portdbc getup xfce4 | sudo tee /etc/ports/xfce4.rsync

Find ports containing xfce but not in the xfce4 repo:

portdbc search xfce | grep -v ' xfce '

List the top 10 duplicated ports:

portdbc dupds | head -10