Home Arch LinuxWhat Are .pacsave Files in Arch Linux and How to Use Them Safely

What Are .pacsave Files in Arch Linux and How to Use Them Safely

By sk
361 views 4 mins read

In our previous tutorial, we learned about Pacnew files and its importance. In this tutorial, we are going to learn what Pacsave files are in Arch Linux, why pacman creates them, and how to restore your old configurations safely after removing a package.

Please note that the .pacsave files are closely related to .pacnew, but they appear in the opposite situation.

What is a .pacsave File?

The .pacsave files appear when you remove a package in Arch Linux and pacman decides to back up your modified configuration files instead of deleting them. These backups let you restore your previous settings if you reinstall the package later.

When you uninstall a package, pacman checks whether its configuration files were changed after installation. If they were, pacman won't delete them outright. It simply renames them by appending .pacsave to the filename.

For example:

/etc/httpd/conf/httpd.conf.pacsave

That file contains your old configuration, saved before the package was removed.

If the file hadn't been modified, pacman would have deleted it instead, since it was identical to the one in the original package.

Why Arch Linux Creates .pacsave Files

Pacman's job is to keep your system consistent but also protect your work. Configuration files often contain personal or system-specific changes.

So during package removal, pacman asks, "Was this config file ever changed?".

  • If no, delete it.
  • If yes, rename it to .pacsave and keep it.

That logic prevents you from losing valuable settings when you remove software temporarily.

When You Might See .pacsave Files

You'll encounter .pacsave files in a few situations:

1. When removing a package with configs you edited

sudo pacman -R apache

If /etc/httpd/conf/httpd.conf was modified, pacman creates /etc/httpd/conf/httpd.conf.pacsave.

2. When removing with the -Rns flags

Even when removing unneeded dependencies, pacman still saves your edited files as .pacsave for safety.

3. When a hook or script preserves configs

Some Arch packages use post-remove hooks that trigger the same behavior.

How to Restore a .pacsave File

If you reinstall a package later and want to restore your old settings, you can simply rename the .pacsave file back to its original name.

Example:

sudo mv /etc/httpd/conf/httpd.conf.pacsave /etc/httpd/conf/httpd.conf

Then restart or reload the related service:

sudo systemctl restart httpd

Now your previous configuration is active again.

How to Find All .pacsave Files on Your Arch Linux System

You can search for all .pacsave files using the find command:

sudo find /etc -type f -name "*.pacsave"

If you have pacman-contrib installed, pacdiff can also list them along with .pacnew files:

sudo pacman -S pacman-contrib
sudo pacdiff

pacdiff helps review and clean up leftover config backups in one place.

When to Remove .pacsave Files

It's safe to remove .pacsave files only if:

  • You no longer plan to reinstall the package.
  • You have reviewed the file and confirmed it contains nothing important.

To remove a .pacsave file:

sudo rm /etc/httpd/conf/httpd.conf.pacsave

To be cautious, you can back it up elsewhere before deleting:

sudo mv /etc/httpd/conf/httpd.conf.pacsave ~/backup/

Best Practice: Review After Package Removal

Each time you uninstall software, check whether any .pacsave files were created. This helps avoid confusion later if you reinstall the same package and wonder why your old settings are missing.

To quickly check the pacsave files, run:

sudo find /etc -name "*.pacsave"

Regularly reviewing .pacsave files keeps your /etc directory tidy and ensures you don't lose valuable configuration data.

Summary: What to Remember About .pacsave Files

TaskCommand
Find .pacsave filessudo find /etc -name "*.pacsave"
Restore old settingssudo mv file.pacsave file
Review after removalsudo pacdiff
Remove safelysudo rm file.pacsave

Frequently Asked Questions (FAQ) About .pacsave Files

Q: What's the difference between .pacnew and .pacsave?

A: .pacnew appears after an upgrade to protect your modified files from being overwritten, while .pacsave appears after a removal to preserve your edited configurations.

Q: Can I delete .pacsave files right away?

A: You can, but it's safer to read them first. They might contain valuable custom settings you'll want if you reinstall the package later.

Q: Does every package create .pacsave files?

A: No. Pacman creates them only when a package includes configuration files that have been locally changed.

Q: How do I manage .pacsave and .pacnew files together?

A: Install pacman-contrib and use pacdiff. It automatically detects both types and helps you manage them in one go.

Conclusion

The .pacsave files are one of pacman's smartest features. They act as safety nets for your configuration files, ensuring you never lose custom settings when uninstalling software.

By checking for .pacsave files after every removal and reviewing them before deletion, you can keep your Arch Linux system clean, organized, and secure, without losing your old config files.

References:

You May Also Like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More