LinuxCommandLibrary

rankmirrors

Find fastest mirror from a list of mirrors

TLDR

Rank a mirror list

$ rankmirrors [/etc/pacman.d/mirrorlist]
copy

Output only a given number of the top ranking servers
$ rankmirrors -n [number] [/etc/pacman.d/mirrorlist]
copy

Be verbose when generating the mirrorlist
$ rankmirrors [[-v|--verbose]] [/etc/pacman.d/mirrorlist]
copy

Test only a specific URL
$ rankmirrors [[-u|--url]] [url]
copy

Output only the response times instead of a full mirrorlist
$ rankmirrors [[-t|--times]] [/etc/pacman.d/mirrorlist]
copy

SYNOPSIS


rankmirrors [options] <mirrorlist_file>

PARAMETERS

-n <number>
    
Output the top <number> of mirrors after ranking.

-v
    
Enable verbose output, displaying detailed progress of mirror tests.

-p <protocols>
    
Only test mirrors using the specified comma-separated <protocols> (e.g., http,https).

-r
    
Reverse the sort order, listing the slowest mirrors first.

-t <seconds>
    
Set the connection timeout for each mirror test to <seconds>.

-o <file>
    
Write the ranked mirrorlist to <file> instead of standard output.

-h
    
Display help message and exit.

DESCRIPTION


The rankmirrors command is a crucial utility primarily used within the
Arch Linux ecosystem, specifically alongside its Pacman package manager.
Its core function is to intelligently evaluate and sort the mirrors listed
in a system's mirrorlist file based on their current connection speed and
responsiveness. By performing network tests to each specified mirror,
rankmirrors can determine which servers offer the fastest download
speeds at a given time. The output is a new, reordered mirrorlist,
typically written to standard output, which can then be used to update
the system's active mirror configuration. This process is vital for
Arch Linux users as it ensures that package downloads, system updates,
and software installations are sourced from the most efficient servers,
thereby significantly reducing download times and improving the overall
efficiency and reliability of package management operations.
It helps maintain an optimized and responsive Arch Linux installation.

CAVEATS


rankmirrors relies on active network connectivity and mirror availability during its execution.
Temporary network issues or mirror outages can significantly affect the ranking results.
It is specifically designed for the Arch Linux mirrorlist format and may not be compatible
with mirror configurations used by other Linux distributions.
The actual download speed experienced by the user may still vary due to factors
beyond the command's testing scope, such as local network conditions or server load.

<BR>COMMON USAGE EXAMPLE


To rank the default mirrorlist, output the top 5 fastest HTTPS mirrors,
and save them to a new file named /etc/pacman.d/mirrorlist.new:
rankmirrors -n 5 -p https /etc/pacman.d/mirrorlist > /etc/pacman.d/mirrorlist.new

After reviewing the content of the .new file,
it can be moved to replace the active mirrorlist:
mv /etc/pacman.d/mirrorlist.new /etc/pacman.d/mirrorlist

HISTORY


rankmirrors is an integral component of the
pacman-contrib package,
a collection of supplementary utilities for Arch Linux's Pacman package manager.
Its development has consistently been driven by the Arch Linux community's need
to efficiently manage and optimize package download sources.
It emerged as an automation tool to streamline the process of identifying the fastest mirrors,
a task that was historically performed manually or via basic scripts.

SEE ALSO

pacman(8)

Copied to clipboard