Experimenting with Arch: Playing some Pacman

In my last few posts I’ve sort of taken it for granted that we all know what the pacman commands I’ve been showing are actually doing. Well just in case not everyone is a pacman expert I figured it might be a good idea to break it down a bit here.

No, not this Pac Man

The Arch Wiki provides an excellent page on this but I’ll include most of the common and neat ones below.

Installing Packages

The -S flag tells pacman to install one or more specific packages. For example:

pacman -S package_name

or

pacman -S package_one package_two package_three

There are other advanced options like installing packages by using a regex, patterns, specifying versions and more. Perhaps the second most common option would be to install by group name. Groups are a kind of meta-package, a collection of various packages that saves you from having to install them all individually. For example, gnome would be a group name. You can install a group just like a normal package:

pacman -S group_name

Removing Packages

Sometimes you just want to uninstall/remove packages from your system. The syntax to do this is identical to the installation method except instead of passing the -S flag you pass -R.

pacman -R package_name

Performing a System Update

If you want to update all of the packages on your system at once you can easily do so with a single command:

pacman -Syu

Search for a Package

Searching for new packages to install is also easy and can be done by passing -Ss like this:

pacman -Ss package_name

If you want to search for something you already have installed you would pass -Qs instead. There are many other options for searches, including how to show various package information, so for that stuff I’d recommend reading the Arch WIki for the full details.

Cleaning up the Cache

Whenever you install something with pacman it stores the downloaded package in a directory under /var/cache/pacman/pkg/. This can grow rather large over time so it may be a good idea to periodically clean this up. To do so simply run this command:

pacman -Sc

Miscellaneous Commands

Here are a few neat commands that may be of use as well.

To install a package from a local file or remote directory instead of from the repository use:

pacman -U /path/to/package/package_name-version.pkg.tar.xz

where the path could also look like http://…./package_name-version.pkg.tar.xz

Or if you do want to download the package from the repository but not install it you can just run:

pacman -Sw package_name

Conclusion

Hopefully this post been useful. Happy Arching!



Be the first to comment

Leave a Reply

Your email address will not be published.


*