27

What is the command for Arch Linux to update the packages before installing a new package?

For instance, I know that in Ubuntu, I do this in a terminal window:

sudo apt-get update
sudo apt-get <package name>

What about in Arch Linux?

I came across a couple of versions, but they don't seem agree with each others. I can't see the consistency there.

Example 1. (it looks tedious to me):

sudo pacman -Syy
sudo pacman -Su

Example 2:

sudo pacman -Sy

Example 3:

always use "-Sy" with a "u". I.e., "pacman -Syu" and then "pacman -S <package>", and never "pacman -Sy <package>".

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Run
  • 54,938
  • 169
  • 450
  • 748
  • 5
    This is off topic for StackOverflow, since it's not related to software development. I've generally found the Arch documentation to be quite good; if there's a particular document you think isn't sufficiently clear, you may want to [report a bug](https://wiki.archlinux.org/index.php/Reporting_bug_guidelines) so that the Arch folks can improve the documentation. – larsks Mar 30 '17 at 17:55
  • 2
    `pacman -Syu` https://wiki.archlinux.org/index.php/Pacman#Upgrading_packages – Hackerman Mar 30 '17 at 20:02
  • Copied without any attribution whatsoever at `9to5answer DOT com/arch-linux-apt-get-update-equivalent-command` (the author link is fake and just points back to the same page) – Peter Mortensen Mar 13 '23 at 15:48

2 Answers2

59

The equivalent of apt-get update in Arch Linux is pacman -Syy.

pacman -Syu is equivalent to apt-get update && apt-get upgrade.

Might as well make this complete if it stays...

pacman -S <package> is apt-get install <package>.

Deanie
  • 2,316
  • 2
  • 19
  • 35
2

Note: I agree with larsks' comment that the best source here is the Arch wiki.

For example, the wiki entry pacman/Rosetta covers the operations for Pacman in depth for people who previously used ("coming from"): DNF (Red Hat Linux/Fedora), APT (Debian/Ubuntu), ZYpp (executable zypper. SUSE Linux Enterprise (SLES)/openSUSE) or Portage (executable emerge. Gentoo Linux).

From that document, apt update && apt upgrade is equivalent to pacman -Syu.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Marcus
  • 922
  • 6
  • 21
  • 2
    Arch is not a good source for documentation. Arch makes changes to the system, and then expects the users to find the changes, address the problem and write out a solution for others. They push problems to the end user instead of taking care of it at a higher level. But every arch admin will tout the phrase 'The best source is the Arch wiki.'. Don't buy into it! – Deanie May 12 '21 at 15:45
  • 2
    @Deanie Arch is really just a minimal system with package repositories. The package manager you use is not dictated by Arch (although `pacman` is the one pre-installed software, yes). The arch community documents the usage of these (independent) software components in their wiki. It's not "them" making changes, it's the end-user's wish for a bleeding-edge system and the changes made by software developers. The Arch wiki to me is an OS-agnostic source of Linux-relevant information. An example is the link I posted: it is helpful even when you migrate from Fedora to Gentoo, i.e.,it's OS-agnostic. – Marcus Jul 08 '21 at 18:19