🐧 Powerful Package Management on Arch Linux: Complete yay Guide
yay
(Yet Another Yaourt) is one of the most popular AUR helpers on Arch Linux and its derivatives (like Manjaro). It allows you to easily manage packages from both official repositories and the AUR (Arch User Repository), supporting searching, installing, upgrading, downgrading, and path inspection—all in one tool.
This guide walks you through everything from basic to advanced usage, including installation, common commands, downgrade methods, and file path viewing—perfect for both beginners and advanced users.
📦 1. What is yay?
yay
is a modern AUR helper written in Go. Its main features include:
- Unified search and install from official and AUR sources.
- Auto-upgrade for both official and AUR packages.
- Support for downgrading to older versions.
- Quick access to package info, dependencies, install paths, etc.
- Easy cache cleanup and orphan package removal.
Compared to traditional tools like yaourt
, yay
is faster, safer, and more suitable for daily package management.
⚙️ 2. How to Install yay
✅ 1. For Manjaro Users
sudo pacman -S yay
✅ 2. For Arch Linux Users (Manual Method)
sudo pacman -S --needed git base-devel
cd /tmp
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
🚀 3. yay Command Quick Reference
Feature | Command |
---|---|
Search (official + AUR) | yay package_name |
Install a package | yay -S package_name |
Upgrade all packages (AUR) | yay -Syu |
Clean cache | yay -Sc |
Remove unused dependencies | yay -Yc |
Remove package & config | yay -Rns package_name |
Install only AUR package | yay -S package_name --aur |
Install only repo package | yay -S package_name --repo |
View package info | yay -Si package_name |
View package file paths | yay -Ql package_name |
Find package owning a file | yay -Qo /path/to/file |
List installed AUR packages | yay -Qm |
⬇️ 4. How to Downgrade a Package
Sometimes new versions are unstable or incompatible. You can roll back using the following methods:
✅ 1. Using downgrade
Tool (Recommended)
yay -S downgrade
sudo downgrade package_name
- Lists historical versions for selection.
- Supports adding to
IgnorePkg
to prevent future upgrades.
✅ 2. Install a Versioned AUR Package
Some AUR packages include specific versions:
yay -S electron14
✅ 3. Install from Local Cache
ls /var/cache/pacman/pkg/ | grep package_name
sudo pacman -U /var/cache/pacman/pkg/xxx.pkg.tar.zst
✅ 4. Download from Arch Archive
If you never installed it before:
👉 https://archive.archlinux.org/packages/
Example:
# e.g., nginx
wget https://archive.archlinux.org/packages/n/nginx/nginx-1.24.0-1-x86_64.pkg.tar.zst
sudo pacman -U nginx-1.24.0-1-x86_64.pkg.tar.zst
Don’t forget to prevent upgrades afterward: Edit
/etc/pacman.conf
and add:
IgnorePkg = nginx
🔍 5. View Installed Package Information
✅ 1. View Detailed Info
yay -Qi package_name
✅ 2. View All Installed Files
yay -Ql package_name
Example:
yay -Ql google-chrome
Output:
google-chrome /opt/google/chrome/
google-chrome /usr/bin/google-chrome-stable
...
✅ 3. View Top-Level Install Directories Only
yay -Ql package_name | cut -d' ' -f2 | cut -d'/' -f1-3 | sort -u
Example:
yay -Ql nginx | cut -d' ' -f2 | cut -d'/' -f1-3 | sort -u
Output:
/etc/nginx
/usr/bin
/usr/lib
✅ 4. Find Which Package Owns a File
yay -Qo /usr/bin/nginx
Or using pacman directly:
pacman -Qo /usr/lib/libssl.so.3
🧹 6. System Cleanup
✅ Clean Build Cache
yay -Sc
✅ Remove Unused Dependencies
yay -Yc
🧠 7. Extra Tips
✅ List All AUR Packages (Non-official)
yay -Qm
✅ List All Installed Packages
yay -Q
✍️ 8. Summary: Must-Know yay Tricks
Feature | Example Command |
---|---|
Search | yay firefox |
Install AUR package | yay -S visual-studio-code-bin |
Downgrade package | sudo downgrade nginx |
View install paths | yay -Ql package_name |
File → package | yay -Qo /path/to/file |
Clean system | yay -Sc && yay -Yc |
📎 Appendix
- yay project: https://github.com/Jguer/yay
- Arch Linux package archive: https://archive.archlinux.org
- downgrade AUR page: https://aur.archlinux.org/packages/downgrade