Introduction

FreeBSD's pkg(8) is a powerful, modern tool for managing packages. This page hopes to provide a resource through which you can translate your existing package management knowledge directly to FreeBSD.

This page is presently a work in progress.

Traditional ports (FreeBSD, DragonFly)

Task

ports

pkg

Configuration files/dirs

/etc/pkg/
/usr/local/etc/pkg/
/usr/local/etc/pkg.conf

Package database (local)

/var/db/pkg/local.sqlite

Package database (remote)

/var/db/pkg/repo-*.sqlite

Locally cached packages

/usr/ports/Packages/All/
/var/cache/pkg/*.pkg

Update database (remote)

portsnap fetch update

pkg update

Manual pages

man 8 ports

pkg help subcommand
man 8 pkg-subcommand

Search package

make -C /usr/ports quicksearch name=pattern
make -C /usr/ports quicksearch key=pattern (description)

pkg search pattern (only by name)

Install package

make -C /usr/ports/category/port install clean

pkg install packagename

Delete single package

make -C /usr/ports/category/port deinstall

pkg delete -f packagename

Delete package and dependencies

pkg delete packagename

List installed packages

pkg info

List files installed by a package

pkg info -l packagename

Upgrade single package with dependencies

make -C /usr/ports/category/port build deinstall reinstall

pkg upgrade packagename

Upgrade all packages

portmaster -a (ports/ports-mgmt/portmaster)

pkg upgrade

Delete automatically installed packages

pkg autoremove

Delete outdated cached packages

portmaster --clean-distfiles (deletes distfiles)

pkg clean

Show repository stats

pkg stats

Find installed package by filename

pkg which filepath

Show vulnerable installed packages

pkg audit -F

Show special updating instructions

less /usr/ports/UPDATING

pkg updating

OpenBSD tools

Task

...

pkg

Configuration files/dirs

...

/etc/pkg/
/usr/local/etc/pkg/
/usr/local/etc/pkg.conf

Package database (local)

...

/var/db/pkg/local.sqlite

Package database (remote)

...

/var/db/pkg/repo-*.sqlite

Locally cached packages

...

/var/cache/pkg/*.pkg

Update database (remote)

...

pkg update

Manual pages

...

pkg help subcommand
man 8 pkg-subcommand

Search package

...

pkg search pattern (only by name)

Install package

...

pkg install packagename

Delete single package

...

pkg delete -f packagename

Delete package and dependencies

...

pkg delete packagename

List installed packages

...

pkg info

List files installed by a package

...

pkg info -l packagename

Upgrade single package with dependencies

...

pkg upgrade packagename

Upgrade all packages

...

pkg upgrade

Delete automatically installed packages

...

pkg autoremove

Delete outdated cached packages

...

pkg clean

Show repository stats

...

pkg stats

Find installed package by filename

...

pkg which filepath

Show vulnerable installed packages

...

pkg audit -F

Show special updating instructions

...

pkg updating

pkgsrc (NetBSD and others)

Task

pkgsrc

pkg

Configuration files/dirs

...

/etc/pkg/
/usr/local/etc/pkg/
/usr/local/etc/pkg.conf

Package database (local)

...

/var/db/pkg/local.sqlite

Package database (remote)

...

/var/db/pkg/repo-*.sqlite

Locally cached packages

...

/var/cache/pkg/*.pkg

Update database (remote)

...

pkg update

Manual pages

...

pkg help subcommand
man 8 pkg-subcommand

Search package

...

pkg search pattern (only by name)

Install package

...

pkg install packagename

Delete single package

...

pkg delete -f packagename

Delete package and dependencies

...

pkg delete packagename

List installed packages

...

pkg info

List files installed by a package

...

pkg info -l packagename

Upgrade single package with dependencies

...

pkg upgrade packagename

Upgrade all packages

...

pkg upgrade

Delete automatically installed packages

...

pkg autoremove

Delete outdated cached packages

...

pkg clean

Show repository stats

...

pkg stats

Find installed package by filename

...

pkg which filepath

Show vulnerable installed packages

...

pkg audit -F

Show special updating instructions

...

pkg updating

apt-get / dpkg (Debian, Ubuntu, Mint)

Task

apt-get / dpkg

pkg

Configuration files/dirs

/etc/apt

/etc/pkg/
/usr/local/etc/pkg/
/usr/local/etc/pkg.conf

Package database (local)

/var/lib/dpkg/status

/var/db/pkg/local.sqlite

Package database (remote)

/var/lib/apt/lists/*

/var/db/pkg/repo-*.sqlite

Locally cached packages

/var/cache/apt/archives/*.deb

/var/cache/pkg/*.pkg

Update database (remote)

apt-get update

pkg update

Manual pages

apt-get(8), apt-cache(8), dpkg(1)

pkg help subcommand
man 8 pkg-subcommand

Search package

apt-cache search pattern

pkg search pattern (only by name)

Install package

apt-get install packagename

pkg install packagename

Delete single package

apt-get remove packagename

pkg delete -f packagename

Delete package and dependencies

...

pkg delete packagename

List installed packages

dpkg -l

pkg info

List files installed by a package

dpkg -L packagename

pkg info -l packagename

Upgrade single package with dependencies

apt-get install packagename

pkg upgrade packagename

Upgrade all packages

apt-get dist-upgrade

pkg upgrade

Delete automatically installed packages

apt-get autoremove

pkg autoremove

Delete outdated cached packages

apt-get autoclean

pkg clean

Show repository stats

pkg stats

pkg stats

Find installed package by filename

dpkg -S filepath

pkg which filepath

Show vulnerable installed packages

---

pkg audit -F

Show special updating instructions

---

pkg updating

apt (Debian bases, Ubuntu, Mint, ...)

Task

apt

pkg

Configuration files/dirs

...

/etc/pkg/
/usr/local/etc/pkg/
/usr/local/etc/pkg.conf

Package database (local)

...

/var/db/pkg/local.sqlite

Package database (remote)

...

/var/db/pkg/repo-*.sqlite

Locally cached packages

...

/var/cache/pkg/*.pkg

Update database (remote)

...

pkg update

Manual pages

...

pkg help subcommand
man 8 pkg-subcommand

Search package

...

pkg search pattern (only by name)

Install package

...

pkg install packagename

Delete single package

...

pkg delete -f packagename

Delete package and dependencies

...

pkg delete packagename

List installed packages

...

pkg info

List files installed by a package

...

pkg info -l packagename

Upgrade single package with dependencies

...

pkg upgrade packagename

Upgrade all packages

...

pkg upgrade

Delete automatically installed packages

...

pkg autoremove

Delete outdated cached packages

...

pkg clean

Show repository stats

...

pkg stats

Find installed package by filename

...

pkg which filepath

Show vulnerable installed packages

...

pkg audit -F

Show special updating instructions

...

pkg updating

yum / rpm (RHEL 7, CentOS 7)

Task

yum / rpm

pkg

Configuration files/dirs

/etc/yum.conf
/etc/yum.repos.d/

/etc/pkg/
/usr/local/etc/pkg/
/usr/local/etc/pkg.conf

Package database (local)

/var/lib/rpm/

/var/db/pkg/local.sqlite

Package database (remote)

/var/cache/yum/arch/release/*

/var/db/pkg/repo-*.sqlite

Locally cached packages

/var/cache/yum/arch/release/repo/packages/

/var/cache/pkg/*.pkg

Update database (remote)

yum makecache

pkg update

Manual pages

man 8 yum
man 8 rpm

pkg help subcommand
man 8 pkg-subcommand

Search package

yum search pattern

pkg search pattern (only by name)

Install package

yum install packagename

pkg install packagename

Delete single package

yum remove packagename

pkg delete -f packagename

Delete package and dependencies

yum autoremove packagename

pkg delete packagename

List installed packages

rpm -qa
yum info

pkg info

List files installed by a package

rpm -ql packagename

pkg info -l packagename

Upgrade single package with dependencies

yum upgrade packagename
yum upgrade-to versionedpackagename

pkg upgrade packagename

Upgrade all packages

yum update
(also see yum(8) for 'yum upgrade')

pkg upgrade

Delete automatically installed packages

yum autoremove

pkg autoremove

Delete outdated cached packages

yum clean packages
(removes all cached packages)

pkg clean

Show repository stats

yum history stats
yum repoinfo

pkg stats

Find installed package by filename

rpm -qf filepath

pkg which filepath

Show vulnerable installed packages

yum list-security
yum --security check-update
(both are RHEL-only)

pkg audit -F

Show special updating instructions

(no equivalent)

pkg updating

zypper / rpm (SuSE, OpenSuSE)

Task

zypper / rpm

pkg

Configuration files/dirs

...

/etc/pkg/
/usr/local/etc/pkg/
/usr/local/etc/pkg.conf

Package database (local)

...

/var/db/pkg/local.sqlite

Package database (remote)

...

/var/db/pkg/repo-*.sqlite

Locally cached packages

...

/var/cache/pkg/*.pkg

Update database (remote)

...

pkg update

Manual pages

...

pkg help subcommand
man 8 pkg-subcommand

Search package

...

pkg search pattern (only by name)

Install package

...

pkg install packagename

Delete single package

...

pkg delete -f packagename

Delete package and dependencies

...

pkg delete packagename

List installed packages

...

pkg info

List files installed by a package

...

pkg info -l packagename

Upgrade single package with dependencies

...

pkg upgrade packagename

Upgrade all packages

...

pkg upgrade

Delete automatically installed packages

...

pkg autoremove

Delete outdated cached packages

...

pkg clean

Show repository stats

...

pkg stats

Find installed package by filename

...

pkg which filepath

Show vulnerable installed packages

...

pkg audit -F

Show special updating instructions

...

pkg updating

dnf / rpm (Fedora)

Task

dnf / rpm

pkg

Configuration files/dirs

...

/etc/pkg/
/usr/local/etc/pkg/
/usr/local/etc/pkg.conf

Package database (local)

...

/var/db/pkg/local.sqlite

Package database (remote)

...

/var/db/pkg/repo-*.sqlite

Locally cached packages

...

/var/cache/pkg/*.pkg

Update database (remote)

...

pkg update

Manual pages

...

pkg help subcommand
man 8 pkg-subcommand

Search package

...

pkg search pattern (only by name)

Install package

...

pkg install packagename

Delete single package

...

pkg delete -f packagename

Delete package and dependencies

...

pkg delete packagename

List installed packages

...

pkg info

List files installed by a package

...

pkg info -l packagename

Upgrade single package with dependencies

...

pkg upgrade packagename

Upgrade all packages

...

pkg upgrade

Delete automatically installed packages

...

pkg autoremove

Delete outdated cached packages

...

pkg clean

Show repository stats

...

pkg stats

Find installed package by filename

...

pkg which filepath

Show vulnerable installed packages

...

pkg audit -F

Show special updating instructions

...

pkg updating

emerge (Gentoo)

Task

emerge

pkg

Configuration files/dirs

...

/etc/pkg/
/usr/local/etc/pkg/
/usr/local/etc/pkg.conf

Package database (local)

...

/var/db/pkg/local.sqlite

Package database (remote)

...

/var/db/pkg/repo-*.sqlite

Locally cached packages

...

/var/cache/pkg/*.pkg

Update database (remote)

...

pkg update

Manual pages

...

pkg help subcommand
man 8 pkg-subcommand

Search package

...

pkg search pattern (only by name)

Install package

...

pkg install packagename

Delete single package

...

pkg delete -f packagename

Delete package and dependencies

...

pkg delete packagename

List installed packages

...

pkg info

List files installed by a package

...

pkg info -l packagename

Upgrade single package with dependencies

...

pkg upgrade packagename

Upgrade all packages

...

pkg upgrade

Delete automatically installed packages

...

pkg autoremove

Delete outdated cached packages

...

pkg clean

Show repository stats

...

pkg stats

Find installed package by filename

...

pkg which filepath

Show vulnerable installed packages

...

pkg audit -F

Show special updating instructions

...

pkg updating

pacman (Arch)

Task

pacman

pkg

Configuration files/dirs

/etc/pacman.d/
/etc/pacman.conf

/etc/pkg/
/usr/local/etc/pkg/
/usr/local/etc/pkg.conf

Package database (local)

/var/lib/pacman/local/

/var/db/pkg/local.sqlite

Package database (remote)

/var/lib/pacman/sync/

/var/db/pkg/repo-*.sqlite

Locally cached packages

/var/cache/pacman/pkg/

/var/cache/pkg/*.pkg

Update database (remote)

pacman -Sy
(Use caution)

pkg update

Manual pages

pacman operation --help
man 8 pacman

pkg help subcommand
man 8 pkg-subcommand

Search package

pacman -Ss pattern (remote)
pacman -Qs pattern (installed)

pkg search pattern (only by name)

Install package

pacman -S packagename

pkg install packagename

Delete single package

pacman -R packagename

pkg delete -f packagename

Delete package and dependencies

pacman -Rs packagename

pkg delete packagename

List installed packages

pacman -Q

pkg info

List files installed by a package

pacman -Ql packagename

pkg info -l packagename

Upgrade single package with dependencies

(Not supported)

pkg upgrade packagename

Upgrade all packages

pacman -Syu

pkg upgrade

Delete automatically installed packages

...

pkg autoremove

Delete outdated cached packages

pacman -Sc

pkg clean

Show repository stats

...

pkg stats

Find installed package by filename

pacman -Qo filepath

pkg which filepath

Show vulnerable installed packages

...

pkg audit -F

Show special updating instructions

...

pkg updating

slackpkg / sbotools (Slackware)

Task

slackpkg / sbotools

pkg

Configuration files/dirs

/etc/slackpkg/*
/etc/sbotools/sbotools.conf
man 5 sbotools.conf
man 1 sboconf

/etc/pkg/
/usr/local/etc/pkg/
/usr/local/etc/pkg.conf

Package database (local)

/var/log/packages

/var/db/pkg/local.sqlite

Package database (remote)

/var/lib/slackpkg/

/var/db/pkg/repo-*.sqlite

Locally cached packages

/var/cache/packages/
/usr/sbo/repo

/var/cache/pkg/*.pkg

Update database (remote)

slackpkg update

pkg update

Manual pages

man 8 slackpkg
man 1 sbosubcommand

pkg help subcommand
man 8 pkg-subcommand

Search package

sbofind pattern

pkg search pattern (only by name)

Install package

sboinstall packagename

pkg install packagename

Delete single package

removepkg packagename

pkg delete -f packagename

Delete package and dependencies

sboremove packagename
(slackbuilds.org packages only)

pkg delete packagename

List installed packages

ls /var/log/packages

pkg info

List files installed by a package

cat /var/log/packages/packagename

pkg info -l packagename

Upgrade single package with dependencies

sboupgrade packagename
(slackbuilds.org only)

pkg upgrade packagename

Upgrade all packages

slackpkg upgrade ; slackpkg install-new ; slackpkg upgrade-all
sboupgrade --all

pkg upgrade

Delete automatically installed packages

no equivalent

pkg autoremove

Delete outdated cached packages

no equivalent

pkg clean

Show repository stats

no equivalent

pkg stats

Find installed package by filename

grep filepath /var/log/packages/*

pkg which filepath

Show vulnerable installed packages

no equivalent

pkg audit -F

Show special updating instructions

no equvialent

pkg updating

Solaris package tools

Task

pkgadd etc.

pkg

Configuration files/dirs

...

/etc/pkg/
/usr/local/etc/pkg/
/usr/local/etc/pkg.conf

Package database (local)

...

/var/db/pkg/local.sqlite

Package database (remote)

...

/var/db/pkg/repo-*.sqlite

Locally cached packages

...

/var/cache/pkg/*.pkg

Update database (remote)

...

pkg update

Manual pages

...

pkg help subcommand
man 8 pkg-subcommand

Search package

...

pkg search pattern (only by name)

Install package

...

pkg install packagename

Delete single package

...

pkg delete -f packagename

Delete package and dependencies

...

pkg delete packagename

List installed packages

...

pkg info

List files installed by a package

...

pkg info -l packagename

Upgrade single package with dependencies

...

pkg upgrade packagename

Upgrade all packages

...

pkg upgrade

Delete automatically installed packages

...

pkg autoremove

Delete outdated cached packages

...

pkg clean

Show repository stats

...

pkg stats

Find installed package by filename

...

pkg which filepath

Show vulnerable installed packages

...

pkg audit -F

Show special updating instructions

...

pkg updating

Your system's tools...

Tell us what we're missing!

Notes

Unlike some other package managers, FreeBSD's pkg does not handle starting and stopping of services when packages are installed or deleted. You have to use "service rcscript <start|stop|restart>" manually. To restart all enabled services installed from ports use "service -R"

To Do for this page:


CategoryPorts

PackageManagerRosettaStone (last edited 2023-05-30T07:48:27+0000 by PatrickChieppe)