How to Use the Command 'paru' (with Examples)
- Linux
- December 17, 2024
‘Paru’ is an AUR (Arch User Repository) helper and pacman wrapper that simplifies the process of managing packages on an Arch-based Linux system. It provides a unified interface to install, update, view, and manage packages from both the official repositories and the AUR, making it a powerful tool for both new users and experienced system administrators. The following sections illustrate practical use cases of the ‘paru’ command with examples.
Use Case 1: Interactively Search for and Install a Package
Code:
paru package_name_or_search_term
Motivation: Searching and installing packages is a fundamental task when managing an Arch Linux system. Often, you need to find and install packages not available in the official repositories, which requires searching through the AUR. Using ‘paru’, users can interactively search and install packages in one streamlined command. This reduces the need for multiple commands and simplifies the process of finding the right package.
Explanation:
paru
: Invokes the paru command-line tool.package_name_or_search_term
: This placeholder indicates the name of the package or a search term relevant to the package you are interested in. When executed, ‘paru’ will list matching packages.
Example Output:
1 aur/firefox-nightly 90.0a1-1 (+35 0.00)
Firefox Nightly builds
2 aur/firefox-developer-edition 89.0b15-1 (+27 0.00)
Developer Edition of the popular Firefox web browser
3 extra/firefox 88.0.1-1 (20.3 MiB 28.5 MiB) (Installed)
Standalone web browser from mozilla.org
Enter a number (default=1):
Use Case 2: Synchronize and Update All Packages
Code:
paru
Motivation: Keeping your system updated with the latest packages ensures you have the newest features, security patches, and bug fixes. Regularly updating all packages, both from the official repositories and the AUR, is essential for system stability and security. ‘Paru’ offers an efficient method to perform this task with a single command.
Explanation:
paru
: This command without any additional arguments will perform a full system upgrade. It synchronizes the package databases and checks for updates to any installed packages from both the AUR and standard repositories.
Example Output:
:: Synchronizing package databases...
core is up to date
extra is up to date
community is up to date
:: Starting full system upgrade...
there is nothing to do
Use Case 3: Upgrade AUR Packages
Code:
paru -Sua
Motivation: AUR packages are third-party packages and may need separate management compared to the official package repositories. With ‘paru’, you can selectively upgrade only the AUR packages installed on your system. This function is useful when you want to avoid updating your entire system but still maintain the AUR components.
Explanation:
paru
: Calls the paru tool.-S
: A flag for syncing, updating, and installing packages.-u
: Specifies to upgrade packages.-a
: Tells paru to include AUR packages in the upgrade process.
Example Output:
:: Starting full system upgrade for AUR...
there is nothing to do
Use Case 4: Get Information About a Package
Code:
paru -Si package
Motivation: Before installing a package, it often helps to know detailed information about it, such as its dependencies, size, licensing, and version. This can assist in making informed decisions regarding the package installation. Paru allows users to retrieve such details easily.
Explanation:
paru
: Executes the paru command.-S
: With thei
flag, it indicates showing information.i
: Fetches detailed information about the specified package.package
: The specific package you’re inquiring about.
Example Output:
Repository : extra
Name : firefox
Version : 88.0.1-1
Description : Standalone web browser from mozilla.org
Architecture : x86_64
URL : https://www.mozilla.org/firefox/
Use Case 5: Download PKGBUILD
and Other Package Source Files from the AUR or ABS
Code:
paru --getpkgbuild package
Motivation: For users looking to build packages from source or customize them, obtaining the ‘PKGBUILD’ and other source files is necessary. This allows you to see the build configuration and modify it according to your needs before compiling the package manually.
Explanation:
paru
: Initiates the paru command.--getpkgbuild
: Instructs paru to download the ‘PKGBUILD’ file along with associated sources.package
: The name of the package for which you want to download source files.
Example Output:
:: Retrieving package sources...
-> Cloning aur/firefox-nightly from AUR...
Cloning into 'firefox-nightly'...
done.
Use Case 6: Display the PKGBUILD
File of a Package
Code:
paru --getpkgbuild --print package
Motivation: When experimenting with or examining how a package is built, you may want to directly view the ‘PKGBUILD’ file without downloading it. Viewing the build script helps in understanding the build process, dependencies, and customization options available for the package.
Explanation:
paru
: Calls the paru command.--getpkgbuild
: Indicates that you want to fetch the ‘PKGBUILD’ file.--print
: Directs paru to print the content of the ‘PKGBUILD’ file to the terminal instead of saving it.package
: Refers to the specific package whose ‘PKGBUILD’ you want to view.
Example Output:
# Maintainer: Your Package Maintainer <email@example.com>
pkgname=firefox-nightly
pkgver=90.0a1
pkgrel=1
...
Conclusion:
‘Paru’ is a versatile and efficient tool for managing both official and AUR packages on Arch Linux systems. This powerful command-line utility leverages the ability to search, install, update, and retrieve detailed package information with ease, making package management streamlined and more accessible. Whether you are an average user maintaining a daily-use system, or a developer looking for the latest and customizable software, ‘paru’ provides the commands needed to take full control of your Arch Linux environment.