blog/source/_posts/Linux/pacman.md
2022-09-04 02:47:29 +08:00

35 lines
745 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: pacman
keywords:
- Arch Linux
- pacman
categories:
- Linux
tags:
- Arch Linux
date: 2022-08-31 14:08:30
---
``` bash 使用 rankmirrors 将 mirrorlist 中的 mirrors 进行排序
rankmirrors /etc/pacman.d/mirrorlist.china > /etc/pacman.d/mirrorlist
```
# 自动清理老旧的包缓存
建立一个 hook 文件在 `/etc/pacman.d/hooks/clean_package_cache.hook`,内容如下:
``` conf
[Trigger]
Operation = Upgrade
Operation = Install
Operation = Remove
Type = Package
Target = *
[Action]
Description = Cleaning pacman cache...
When = PostTransaction
Exec = /usr/bin/paccache -rk3
```
系统会在每次安装升级卸载以后执行 `/usr/bin/paccache -rk3` 删除包的历史缓存仅保留最近的3个版本。