Skip to content

Instantly share code, notes, and snippets.

@ram0973
Created May 21, 2019 12:37
Show Gist options
  • Save ram0973/393b5909613ff0deedb772b06bfa7f88 to your computer and use it in GitHub Desktop.
Save ram0973/393b5909613ff0deedb772b06bfa7f88 to your computer and use it in GitHub Desktop.
Oneliner that select best (by download speed) mirror based on mirrors.ubuntu.com for yours ip.
curl -s http://mirrors.ubuntu.com/mirrors.txt | xargs -n1 -I {} sh -c 'echo `curl -r 0-102400 -s -w %{speed_download} -o /dev/null {}/ls-lR.gz` {}' |sort -g -r |head -1| awk '{ print $2 }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment