Installing software is one of the few things that genuinely differs between distro families. Which command you use depends on which family you are on (see Chapter 1):
| Family | Command | Package format |
|---|---|---|
| Debian (Ubuntu, Mint) | apt |
.deb |
| Red Hat (Fedora) | dnf |
.rpm |
| Arch (Arch, CachyOS) | pacman |
Arch packages |
The commands below map 1:1 across the three families. All package
actions need root on every distro — sudo is how you get there
(Chapter 5).
Search for a package
$ apt search tmux # Ubuntu
$ dnf search tmux # Fedora
$ pacman -Ss tmux # Arch
On Arch, the pattern is a substring match, so tmux also matches packages
that merely mention tmux. Use anchors for an exact name:
$ pacman -Ss "^tmux$"
extra/tmux 3.7-1
Terminal multiplexer
Show information about a package
$ apt show htop # Ubuntu
$ dnf info htop # Fedora
$ pacman -Si htop # Arch
Install a package
$ sudo apt install htop # Ubuntu
$ sudo dnf install htop # Fedora
$ sudo pacman -S htop # Arch
Install several packages at once:
$ sudo apt install htop tmux git
Update the package lists
Ubuntu and Fedora keep a local index of available packages; refresh it first:
$ sudo apt update # Ubuntu
$ sudo dnf makecache # Fedora
Arch has no separate step — -Sy both refreshes and installs. Prefer a full
-Syu (refresh + upgrade) so the system stays consistent:
$ sudo pacman -Syu # Arch
Upgrade installed packages
$ sudo apt upgrade # Ubuntu
$ sudo dnf upgrade # Fedora
$ sudo pacman -Syu # Arch
On Ubuntu, apt full-upgrade also handles package removals when needed for a
clean upgrade.
Remove a package
$ sudo apt remove htop # Ubuntu
$ sudo dnf remove htop # Fedora
$ sudo pacman -R htop # Arch
On Ubuntu, purge also removes configuration files. On Arch, -Rns also
removes unneeded dependencies and configuration:
$ sudo apt purge htop # Ubuntu
$ sudo pacman -Rns htop # Arch
List installed packages
$ apt list --installed | less # Ubuntu
$ dnf list installed | less # Fedora
$ pacman -Q | less # Arch
Clean up unused packages
$ sudo apt autoremove # Ubuntu: remove orphaned dependencies
$ sudo dnf autoremove # Fedora
$ sudo pacman -Rns $(pacman -Qdtq) # Arch: remove orphaned deps (d=dep, t=unneeded)
Graphical alternative: Ubuntu Software Center / GNOME Software on Ubuntu, GNOME Software or Discover on Fedora, and pamac/octopi on Arch provide the same operations graphically.
A warning: always use the distro’s package manager rather than installing random scripts or binaries from the web. The package manager tracks files and updates, and checks integrity — a manual install bypasses all of that.