Download the resources for the URLs in the specified file and save them to the specified local directory through the Wget tool and perform file integrity and reliability checks

Source: Internet
Author: User
Tags egrep

  1. Create a URLs file
    in the terminal input
    CD target_directory
    Enter, then switch the current folder to the target folder target_directory,
    Files created after that will be thrown inside.
    in the terminal input
    Cat > URLs
    Enter (Note: This command is not over yet, and will continue to type multiple lines of content later)
    Create a file URLsand write a bunch of URLs right away
    use a browser to access the site where the target resource resides,
    when you find the file you want to download, click the right mouse button to invoke the right-click menu.
    Select "Copy Link", then go back to the terminal,
    paste the copied link to the next line of the cat > URLs command,
    and then go to the China, the process of yellow,
    paste another link from the copy to the next line,
    so go on,
    until you have all the resources you want to download
    (including check files such as md5sums, sha512sums, etc.)
    The link is typed to the terminal one line at a
    press CTRL + D to end input, file urls was created;
  2. created to hold folder
    at terminal input
    mkdir directory name
    (this is the directory name from: mydownloads)
    Enter, which is in the current directory
    ( That is, the above CD feeds target_directory ) created a
    Span style= "FONT-SIZE:14PX; Background-color: #ccffff "> name

  3. download wget
    Enter
    in the terminal wget-i urls-p./mydownloads
    Enter, and the resource download will be completed automatically.
    The default file name for downloaded files is taken from the last/subsequent part of the resource link,

    The downloaded file default file name is Usermanual.pdf,
    However, sometimes the end of a resource link may contain '? ' or ' = ' is not suitable as a string for file name,
    Then you need to attach the-o parameter to its download instruction to re-save the file name:
    Span style= "Background-color: #00ffff" > wget-i urls-p./mydownloads -o self-prepared file name
    After the download is complete, mydownloads directory
    is all files downloaded.
    In addition to the file name containing the checksum code
    (for example: Md5sums, Sha256sums, sha512sums)
    without dots and suffixes, is the file name with the point and suffix of the resource file
    Example
  4. Verifying the reliability of downloaded files
    in the terminal input
    CD Mydownloads
    Enter, switch the current directory to the directory where the downloaded resources are stored
    in the terminal input
    Md5sum-c < (egrep "' ls * * * '" md5sums)
    or
    Sha512sum-c < (egrep "' ls * * * '" sha512sums)
    Enter to verify the file.
    The output information is obtained by verifying: file name: OK,
    If a downloaded file does not pass the checksum, the appropriate file should be downloaded again.
  5. comments for the check Directive
    Md5sum or Sha1sum, sha256sum, sha512sum and so on are linuxos universally carried verification tools
    Can be entered in the terminal by
    Ls/usr/bin | grep sum
    Enter to see which file verification tools the system is carrying.
    - c means to perform a file check operation,
    The latter parameter should be a file containing a checksum code
    ' ls * * ' is the file that gets the filename with a dot in the current directory
    (here is the file name of the downloaded files),
    The counter-quotes at both ends of the function are
    The result of the output after executing the instruction in the inverted quotation mark
    Replace the counter-quotes and the instructions that surround them.
    (The inverted quote on the keyboard is the key with the tilde above the TAB key,
    It's an anti-quote if you don't press shift
    in this way, the "LS * * *" in the calibration directive will automatically become a string of filenames surrounded by double quotes,
    then Egrep "' ls * * '" md5sums is
    extract all the md5sums from the file containing the check code
    A line containing a string that matches any file name in a string of filenames surrounded by double quotes,
    The last,< (egrep "' ls * * '" sha512sums) is
    encapsulates the content combination of all matching rows extracted with Egrep into a single file,
    It will also be used in the calibration directive as
    the file that contains the checksum code after the-c parameter.

Download the resources for the URLs in the specified file and save them to the specified local directory through the Wget tool and perform file integrity and reliability checks

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.