wiki/structured/cli.pacman.org
Gabriel Arazas edc686c25c Update wiki on various topics
This update is too large, I made too many notes on stuff. Nonetheless,
it is very nice to see progress. I've made note revisions on the
following topics:

- Learning
- Writing
- Various Linux-related stuff

I've yet to start learning illustration but I'll be starting tomorrow
for an update how do I keep in mind with those writings. There are still
a lot of things to be processed from the backlog with yet more notes on
learning but I keep having those perspectives whenever I practice so
ehhh... Better have those than nothing?

Furthermore, I've also updated the timestamp format. It is pretty simple
to update all of the notes with a couple of `sed` calls.

Aaaand, I've also changed the way how the assets stored with the folders
only leaving it up for the generated files instead of enforcing it on
every note. I create more visual aids and managing them is a pain for
each note. This restructuring frees me of that burden.
2021-07-20 19:52:43 +08:00

2.0 KiB

Command line: pacman

The built-in package manager of Arch Linux (among others). This note is based from pacman v6 and above.

Subcommands

Interestingly, pacman does not have subcommands with specific options. Instead, they go with specific flags denoting a subcommand. Practically, they're just subcommands except appearing as options.

# Rather than 'pacman install podman' or something similar.
pacman -S podman

Here's what you can do with the package manager:

  • -S are concerned with syncing the local database to the remote databases.
  • -F are mostly query-related operations with the database.
  • -R removes installed packages.

You can see more of them in the Operations section of the manual page (i.e., pacman.1).

Examples

Welp, this is what you came for so let's go ahead.

Quickstart

It's a package manager so it's supposed to do basic package manager stuff. All of the shown commands are in longform with the shortform just commented for practical purposes.

# Search for a pacakge
# pacman -Ss podman
pacman --sync --search podman

# Install a package
# pacman -S podman
pacman --sync podman

# Uninstall a package
# pacman -Rns podman
pacman --remove --no-save --recursive podman

# Upgrade the system
# pacman -Syu
pacman --sync --refresh --upgrade

Package search selection

With everybody's favorite fuzzy finder, fzf.

pacman --sync --quiet --search pkg | fzf --prompt "Package to install > " | xargs doas pacman --sync

You can also create a search selection with all of the packages with the following one-liner.

pacman -S --list --quiet \
    | fzf --multi --prompt "Install package(s) > " \
    | xargs doas pacman -S --noconfirm