Batch ping of Ubuntu Server to select the fastest Source

Source: Internet
Author: User

It is inconvenient to operate shell on a virtual machine. simply make the virtual machine a server and use putty to connect it... I learned the basic Linux Script Programming and used it to detect the fastest source. Back up the method.

Previously, I used sudo passwd root on Ubuntu Server to enable the root user. If not, remember to add "sudo" before the command ".

1. Back up the source list file cp/etc/apt/sources. list/etc/apt/sources. list. bak



2. Use vim to open-source list file vim sources. list

3. Press Esc, select all and delete (ggdG), paste the new source, save and exit (: wq ). I pinged one by one and thought the two below would be the best for me. Save the record. "Intrepid" is the code 8.04. If it is 9.04, change it to "jaunty.

Deb http://debian.ustc.edu.cn/Ubuntu/ intrepid main multiverse restricted universe
Deb http://debian.ustc.edu.cn/Ubuntu/ intrepid-backports main multiverse restricted universe
Deb http://debian.ustc.edu.cn/Ubuntu/ intrepid-proposed main multiverse restricted universe
Deb http://debian.ustc.edu.cn/Ubuntu/ intrepid-security main multiverse restricted universe
Deb http://debian.ustc.edu.cn/Ubuntu/ intrepid-updates main multiverse restricted universe
Deb-src http://debian.ustc.edu.cn/Ubuntu/ intrepid main multiverse restricted universe
Deb-src http://debian.ustc.edu.cn/Ubuntu/ intrepid-backports main multiverse restricted universe
Deb-src http://debian.ustc.edu.cn/Ubuntu/ intrepid-proposed main multiverse restricted universe
Deb-src http://debian.ustc.edu.cn/Ubuntu/, intrepid-security main multiverse restricted universe
Deb-src http://debian.ustc.edu.cn/Ubuntu/, intrepid-updates main multiverse restricted universe

Deb http://nz.archive.Ubuntu.com/ubuntu/ intrepid main restricted universe multiverse
Deb http://nz.archive.Ubuntu.com/ubuntu/ intrepid-security main restricted universe multiverse
Deb http://nz.archive.Ubuntu.com/ubuntu/ intrepid-updates main restricted universe multiverse
Deb http://nz.archive.Ubuntu.com/ubuntu/ intrepid-backports main restricted universe multiverse
Deb http://nz.archive.Ubuntu.com/ubuntu/ intrepid-proposed main restricted universe multiverse
Deb-src http://nz.archive.Ubuntu.com/ubuntu/ intrepid main restricted universe multiverse
Deb-src http://nz.archive.Ubuntu.com/ubuntu/ intrepid-security main restricted universe multiverse
Deb-src http://nz.archive.Ubuntu.com/ubuntu/, intrepid-updates main restricted universe multiverse
Deb-src http://nz.archive.Ubuntu.com/ubuntu/ intrepid-backports main restricted universe multiverse
Deb-src http://nz.archive.Ubuntu.com/ubuntu/ intrepid-proposed main restricted universe multiverse

5. update the source apt-get update.

6. Update the installed software package apt-get upgrade. If you want to update the entire system to the latest release, you can also update apt-get dist-upgrade.

Well, in order to facilitate future testing of the source speed, you can simply write a script to Perform Batch detection.

Run vim ping. sh to create a new file, write the following script, and save the file.

#! /Bin/sh
For ip in 'cat testlist'
Do
Ping-c 5-q $ ip;
Done
Create a new testlist file to save the source domain name vim testlist

Nz.archive.Ubuntu.com
Archive.Ubuntu.com
Mirrors.163.com
Cn.archive.Ubuntu.com
Pai.lupaworld.com
Ubuntu.realss.cn
Ubuntu.uestc.edu.cn
Www.britepic.org
Ftp.sjtu.edu.cn
Debian.ustc.edu.cn
Ubuntu.csie.ntu.edu.tw
Developer.rootguide.org
Tw.archive.Ubuntu.com

Here we need to run chmod 755 ping. sh to grant it the execution permission, and then run./ping. sh. The result will be displayed on the screen. For the sake of simplicity, I added the-q parameter to the ping command to display only the final statistical results, and ping the command for five consecutive times.
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.