702-100 practice question 3 of 15

Which FreeBSD command updates packages to newer versions'?

Full set: 60 questions
Answer options
A: pkg update
B: pkg refresh
C: pkg upgrade Correct answer
D: pkg audit
E: pkg pull
Correct Answer:
C. pkg upgrade
Explanation

The pkg upgrade command in FreeBSD is used to upgrade installed packages to their latest available versions. It compares the versions of packages currently installed on the system against the versions listed in the local repository catalogue. If a newer version is found in the catalogue, pkg upgrade will download and install it. This process is often preceded by pkg update, which updates the local catalogue itself from the remote repository, ensuring the system is aware of the newest package versions before attempting an upgrade.

Why Incorrect

A. pkg update: This command only updates the local repository catalogue with the latest information from remote servers; it does not install or upgrade any packages.
B. pkg refresh: This is not a valid subcommand for the FreeBSD pkg utility.
D. pkg audit: This command checks installed packages for known security vulnerabilities but does not perform any version upgrades.
E. pkg pull: This is not a valid subcommand for the FreeBSD pkg utility for upgrading packages.

References

1. FreeBSD Handbook. (2023). Chapter 4. Using pkg for Binary Package Management, Section 4.4.3. Upgrading Installed Packages. The FreeBSD Documentation Project. Retrieved from https://docs.freebsd.org/en/books/handbook/ports/#pkg-upgrade.

Quote: "Upgrading installed packages is also done with pkg. The command is pkg upgrade." This section explicitly identifies pkg upgrade as the correct command for this task.

2. FreeBSD General Commands Manual. (2023). pkg(8). The FreeBSD Project. Retrieved from https://man.freebsd.org/cgi/man.cgi?query=pkg&sektion=8.

Section: COMMANDS, upgrade.

Description: "Upgrade a package to a newer version. The list of packages to upgrade can be specified on the command line, or pkg upgrade can operate on all installed packages." This official manual page confirms the function of the upgrade subcommand.

3. FreeBSD General Commands Manual. (2023). pkg-update(8). The FreeBSD Project. Retrieved from https://man.freebsd.org/cgi/man.cgi?query=pkg-update&sektion=8.

Description: "pkg update is used to update the local copy of the repository catalogue." This distinguishes its function from pkg upgrade.

Scroll to Top