DEV Community

Cover image for How to use Pacman on Arch Linux 🚀
Miguel Neto
Miguel Neto

Posted on

1

How to use Pacman on Arch Linux 🚀

Pacman is the official Arch Linux package manager (which of course is used in other Arch-based distros, such as Manjaro). It features dependency support, package groups, install and uninstall scripts, etc. You can read all the details on the man page for Pacman.

In this article we’ll explore everything you need to know about package management on an Arch-Based distribution, through examples.

Installing and uninstalling packages

To install a package, run pacman -S (as root, of course). If I wanted to install vim, for example, I can run:

sudo pacman -S vim
Enter fullscreen mode Exit fullscreen mode

This will install vim and all the packages it depends on. Now, if you want to uninstall a program, for example vim, run:

sudo pacman -Rns vim
Enter fullscreen mode Exit fullscreen mode

This will remove vim, all of its dependencies, and all of its system configuration files.

Updating

To update all of your programs if they have new versions, run:

sudo pacman -Syu
Enter fullscreen mode Exit fullscreen mode

This will update the package list and upgrade all packages afterwards. Here, -S means sync, y means synchronize package databases (without updating), and u means update.

Searching for a package

If you want to search for a program, let’s say vim, run the following command:

pacman -Ss vim
Enter fullscreen mode Exit fullscreen mode

This is going to search for names or descriptions that has ‘vim’ on it.

Listing packages

To list out all of the packages installed on your system:

pacman -Q
Enter fullscreen mode Exit fullscreen mode

To list the programs that you explicitly installed, without its dependencies:

pacman -Qe
Enter fullscreen mode Exit fullscreen mode

To list out all of the packages installed on your system, but show only the names of the programs:

pacman -Qeq
Enter fullscreen mode Exit fullscreen mode

To list only programs installed from the main repository:

pacman -Qn
Enter fullscreen mode Exit fullscreen mode

To list only programs installed from the AUR:

pacman -Qm
Enter fullscreen mode Exit fullscreen mode

To list all unneeded dependencies:

pacman -Qdt
Enter fullscreen mode Exit fullscreen mode

Cleaning up packages

To remove all the unnecessary packages from the cache and remove unused repositories:

sudo pacman -Sc
Enter fullscreen mode Exit fullscreen mode

Conclusion

Mastering the Pacman package manager is an essential skill for any Arch Linux user. With Pacman, you can easily manage your system’s software, install new packages, and keep your system up to date. By following the steps outlined in this article, you should now have a basic understanding of how to use Pacman to manage your Arch Linux system.

Happy hacking! 💻🌌

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay