Reflector for Arch Linux

Some of these article contents are derived from Google Gemini.
What is reflector?
reflector is a Python script that can retrieve the latest mirror list from the Arch Linux Mirror Status page, filter the most up-to-date mirrors, sort them by speed and overwrite the file /etc/pacman.d/mirrorlist.1
If your main concern is download speed, pacman’s default mirrorlist should be enough, as the first (prioritized) entries are worldwide locations, which automatically pick a content delivery network (CDN) server close to your location to provide fast download speeds.
Currently, reflector is available only in archlinux.
Installation
sudo pacman -Sy reflectorUsage
Running reflector leads to the overwrittance of /etc/pacman.d/mirrorlist file. So, it’s always a good idea to back it up before everything else:
sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bakRun:
reflector --helpto see its available options.
These are the common used ones:2
--save <path>: Write the resulting mirror list to a specified file (usually /etc/pacman.d/mirrorlist).--country <country>: Filter mirrors by country name or ISO 2-letter country code (e.g., United States, Germany, ID).--protocol <protocol>: Filter mirrors by protocol type, such as https or http.--latest <number>: Select the specified number of the most recently synchronized mirrors (-l).--fastest <number>: Select the specified number of the fastest mirrors (-f).--sort <criteria>: Sort the filtered mirrors by rate (download speed), score, age, or country.--verbose: Show detailed progress and status output (-v).--download-timeout <seconds>: Set a custom timeout for mirror speed tests (default is usually 5 seconds).
Preview mirrors without saving
reflector --latest 20 --sort rate --fastest 10Fetch the fastest HTTPS mirrors
sudo reflector --latest 20 --protocol https --sort rate --save /etc/pacman.d/mirrorlistFilter by country and protocol
sudo reflector --country "Indonesia" --protocol rsync --latest 30 --sort rate --save /etc/pacman.d/mirrorlistAutomation (reflector-timer)
You can automate Reflector to update your mirrorlist periodically in the background using systemd units.1
1. Configure default options
Edit /etc/xdg/reflector/reflector.conf to specify your preferred flags (like --country, --protocol, --sort rate, and --save).
2. Enable and start the timer
sudo systemctl enable --now reflector.timer3. Check timer status
systemctl list-timers4. Run and immediate update manually
sudo systemctl start reflector.serviceFootnotes
Support & Share
If this article helped you, please share or support!












