SHASUMS AND grep in verifying Ubuntu download

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












I'm trying to better understand the use of "SHA256SUMS" and "grep." The Ubuntu verify and authenticate tutorial uses the following term: "sha256sum -c SHA256SUMS 2>&1 | grep OK" to verify the download hasn't been corrupted.



I understand it's checking at the SHA256SUMS file that contains two hash values, one for the Desktop version and one for the Live. The usage worked, and I checked it by manually verifying the hash values.



My question is what is the "SHA256SUMS 2>&1" portion doing? Also, it appears to be a part of the "SHA256SUMS" command, though I don't see that usage on the man page I use. Then somehow the result is piped to "grep" to pattern-match with no options.



I'd like to understand it well enough to use the technique in verifying that other software downloads haven't been corrupted.










share|improve this question





















  • Related: What do these symbols “$@”>/dev/null 2>&1" after a command mean?
    – steeldriver
    Sep 8 at 13:44










  • The command is sha256sum -c SHA256SUMS ; 2>&1 is a shell redirection that combines the command's standard error stream 2 with its standard output stream 1 so that both are piped to the grep command
    – steeldriver
    Sep 8 at 13:47














up vote
3
down vote

favorite












I'm trying to better understand the use of "SHA256SUMS" and "grep." The Ubuntu verify and authenticate tutorial uses the following term: "sha256sum -c SHA256SUMS 2>&1 | grep OK" to verify the download hasn't been corrupted.



I understand it's checking at the SHA256SUMS file that contains two hash values, one for the Desktop version and one for the Live. The usage worked, and I checked it by manually verifying the hash values.



My question is what is the "SHA256SUMS 2>&1" portion doing? Also, it appears to be a part of the "SHA256SUMS" command, though I don't see that usage on the man page I use. Then somehow the result is piped to "grep" to pattern-match with no options.



I'd like to understand it well enough to use the technique in verifying that other software downloads haven't been corrupted.










share|improve this question





















  • Related: What do these symbols “$@”>/dev/null 2>&1" after a command mean?
    – steeldriver
    Sep 8 at 13:44










  • The command is sha256sum -c SHA256SUMS ; 2>&1 is a shell redirection that combines the command's standard error stream 2 with its standard output stream 1 so that both are piped to the grep command
    – steeldriver
    Sep 8 at 13:47












up vote
3
down vote

favorite









up vote
3
down vote

favorite











I'm trying to better understand the use of "SHA256SUMS" and "grep." The Ubuntu verify and authenticate tutorial uses the following term: "sha256sum -c SHA256SUMS 2>&1 | grep OK" to verify the download hasn't been corrupted.



I understand it's checking at the SHA256SUMS file that contains two hash values, one for the Desktop version and one for the Live. The usage worked, and I checked it by manually verifying the hash values.



My question is what is the "SHA256SUMS 2>&1" portion doing? Also, it appears to be a part of the "SHA256SUMS" command, though I don't see that usage on the man page I use. Then somehow the result is piped to "grep" to pattern-match with no options.



I'd like to understand it well enough to use the technique in verifying that other software downloads haven't been corrupted.










share|improve this question













I'm trying to better understand the use of "SHA256SUMS" and "grep." The Ubuntu verify and authenticate tutorial uses the following term: "sha256sum -c SHA256SUMS 2>&1 | grep OK" to verify the download hasn't been corrupted.



I understand it's checking at the SHA256SUMS file that contains two hash values, one for the Desktop version and one for the Live. The usage worked, and I checked it by manually verifying the hash values.



My question is what is the "SHA256SUMS 2>&1" portion doing? Also, it appears to be a part of the "SHA256SUMS" command, though I don't see that usage on the man page I use. Then somehow the result is piped to "grep" to pattern-match with no options.



I'd like to understand it well enough to use the technique in verifying that other software downloads haven't been corrupted.







command-line grep checksums sha256






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 8 at 13:35









JWNWSA

426




426











  • Related: What do these symbols “$@”>/dev/null 2>&1" after a command mean?
    – steeldriver
    Sep 8 at 13:44










  • The command is sha256sum -c SHA256SUMS ; 2>&1 is a shell redirection that combines the command's standard error stream 2 with its standard output stream 1 so that both are piped to the grep command
    – steeldriver
    Sep 8 at 13:47
















  • Related: What do these symbols “$@”>/dev/null 2>&1" after a command mean?
    – steeldriver
    Sep 8 at 13:44










  • The command is sha256sum -c SHA256SUMS ; 2>&1 is a shell redirection that combines the command's standard error stream 2 with its standard output stream 1 so that both are piped to the grep command
    – steeldriver
    Sep 8 at 13:47















Related: What do these symbols “$@”>/dev/null 2>&1" after a command mean?
– steeldriver
Sep 8 at 13:44




Related: What do these symbols “$@”>/dev/null 2>&1" after a command mean?
– steeldriver
Sep 8 at 13:44












The command is sha256sum -c SHA256SUMS ; 2>&1 is a shell redirection that combines the command's standard error stream 2 with its standard output stream 1 so that both are piped to the grep command
– steeldriver
Sep 8 at 13:47




The command is sha256sum -c SHA256SUMS ; 2>&1 is a shell redirection that combines the command's standard error stream 2 with its standard output stream 1 so that both are piped to the grep command
– steeldriver
Sep 8 at 13:47










1 Answer
1






active

oldest

votes

















up vote
3
down vote



accepted










The grep command is just there to clean up the output for you. The hash checker checks against all the disk images, so the grep command keeps things simple.



With grep:

ubuntu-core-16-amd64.img.xz: OK



Without grep:

ubuntu-core-16-amd64.img.xz: OK
sha256sum: ubuntu-core-16-cm3.img.xz: No such file or directory
ubuntu-core-16-cm3.img.xz: FAILED open or read
sha256sum: ubuntu-core-16-dragonboard-410c.img.xz: No such file or directory
ubuntu-core-16-dragonboard-410c.img.xz: FAILED open or read
sha256sum: ubuntu-core-16-dragonboard.img.xz: No such file or directory
ubuntu-core-16-dragonboard.img.xz: FAILED open or read
sha256sum: ubuntu-core-16-i386.img.xz: No such file or directory
ubuntu-core-16-i386.img.xz: FAILED open or read
sha256sum: ubuntu-core-16-pi2.img.xz: No such file or directory
ubuntu-core-16-pi2.img.xz: FAILED open or read
sha256sum: ubuntu-core-16-pi3.img.xz: No such file or directory
ubuntu-core-16-pi3.img.xz: FAILED open or read
sha256sum: WARNING: 6 listed files could not be read



Update:
Sorry, I missed the 2>&1 part of your question. That portion directs any error messages to the same place as the standard output messages. This page explains that quirky idiom: https://www.brianstorti.com/understanding-shell-script-idiom-redirect/






share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1073360%2fshasums-and-grep-in-verifying-ubuntu-download%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    3
    down vote



    accepted










    The grep command is just there to clean up the output for you. The hash checker checks against all the disk images, so the grep command keeps things simple.



    With grep:

    ubuntu-core-16-amd64.img.xz: OK



    Without grep:

    ubuntu-core-16-amd64.img.xz: OK
    sha256sum: ubuntu-core-16-cm3.img.xz: No such file or directory
    ubuntu-core-16-cm3.img.xz: FAILED open or read
    sha256sum: ubuntu-core-16-dragonboard-410c.img.xz: No such file or directory
    ubuntu-core-16-dragonboard-410c.img.xz: FAILED open or read
    sha256sum: ubuntu-core-16-dragonboard.img.xz: No such file or directory
    ubuntu-core-16-dragonboard.img.xz: FAILED open or read
    sha256sum: ubuntu-core-16-i386.img.xz: No such file or directory
    ubuntu-core-16-i386.img.xz: FAILED open or read
    sha256sum: ubuntu-core-16-pi2.img.xz: No such file or directory
    ubuntu-core-16-pi2.img.xz: FAILED open or read
    sha256sum: ubuntu-core-16-pi3.img.xz: No such file or directory
    ubuntu-core-16-pi3.img.xz: FAILED open or read
    sha256sum: WARNING: 6 listed files could not be read



    Update:
    Sorry, I missed the 2>&1 part of your question. That portion directs any error messages to the same place as the standard output messages. This page explains that quirky idiom: https://www.brianstorti.com/understanding-shell-script-idiom-redirect/






    share|improve this answer
























      up vote
      3
      down vote



      accepted










      The grep command is just there to clean up the output for you. The hash checker checks against all the disk images, so the grep command keeps things simple.



      With grep:

      ubuntu-core-16-amd64.img.xz: OK



      Without grep:

      ubuntu-core-16-amd64.img.xz: OK
      sha256sum: ubuntu-core-16-cm3.img.xz: No such file or directory
      ubuntu-core-16-cm3.img.xz: FAILED open or read
      sha256sum: ubuntu-core-16-dragonboard-410c.img.xz: No such file or directory
      ubuntu-core-16-dragonboard-410c.img.xz: FAILED open or read
      sha256sum: ubuntu-core-16-dragonboard.img.xz: No such file or directory
      ubuntu-core-16-dragonboard.img.xz: FAILED open or read
      sha256sum: ubuntu-core-16-i386.img.xz: No such file or directory
      ubuntu-core-16-i386.img.xz: FAILED open or read
      sha256sum: ubuntu-core-16-pi2.img.xz: No such file or directory
      ubuntu-core-16-pi2.img.xz: FAILED open or read
      sha256sum: ubuntu-core-16-pi3.img.xz: No such file or directory
      ubuntu-core-16-pi3.img.xz: FAILED open or read
      sha256sum: WARNING: 6 listed files could not be read



      Update:
      Sorry, I missed the 2>&1 part of your question. That portion directs any error messages to the same place as the standard output messages. This page explains that quirky idiom: https://www.brianstorti.com/understanding-shell-script-idiom-redirect/






      share|improve this answer






















        up vote
        3
        down vote



        accepted







        up vote
        3
        down vote



        accepted






        The grep command is just there to clean up the output for you. The hash checker checks against all the disk images, so the grep command keeps things simple.



        With grep:

        ubuntu-core-16-amd64.img.xz: OK



        Without grep:

        ubuntu-core-16-amd64.img.xz: OK
        sha256sum: ubuntu-core-16-cm3.img.xz: No such file or directory
        ubuntu-core-16-cm3.img.xz: FAILED open or read
        sha256sum: ubuntu-core-16-dragonboard-410c.img.xz: No such file or directory
        ubuntu-core-16-dragonboard-410c.img.xz: FAILED open or read
        sha256sum: ubuntu-core-16-dragonboard.img.xz: No such file or directory
        ubuntu-core-16-dragonboard.img.xz: FAILED open or read
        sha256sum: ubuntu-core-16-i386.img.xz: No such file or directory
        ubuntu-core-16-i386.img.xz: FAILED open or read
        sha256sum: ubuntu-core-16-pi2.img.xz: No such file or directory
        ubuntu-core-16-pi2.img.xz: FAILED open or read
        sha256sum: ubuntu-core-16-pi3.img.xz: No such file or directory
        ubuntu-core-16-pi3.img.xz: FAILED open or read
        sha256sum: WARNING: 6 listed files could not be read



        Update:
        Sorry, I missed the 2>&1 part of your question. That portion directs any error messages to the same place as the standard output messages. This page explains that quirky idiom: https://www.brianstorti.com/understanding-shell-script-idiom-redirect/






        share|improve this answer












        The grep command is just there to clean up the output for you. The hash checker checks against all the disk images, so the grep command keeps things simple.



        With grep:

        ubuntu-core-16-amd64.img.xz: OK



        Without grep:

        ubuntu-core-16-amd64.img.xz: OK
        sha256sum: ubuntu-core-16-cm3.img.xz: No such file or directory
        ubuntu-core-16-cm3.img.xz: FAILED open or read
        sha256sum: ubuntu-core-16-dragonboard-410c.img.xz: No such file or directory
        ubuntu-core-16-dragonboard-410c.img.xz: FAILED open or read
        sha256sum: ubuntu-core-16-dragonboard.img.xz: No such file or directory
        ubuntu-core-16-dragonboard.img.xz: FAILED open or read
        sha256sum: ubuntu-core-16-i386.img.xz: No such file or directory
        ubuntu-core-16-i386.img.xz: FAILED open or read
        sha256sum: ubuntu-core-16-pi2.img.xz: No such file or directory
        ubuntu-core-16-pi2.img.xz: FAILED open or read
        sha256sum: ubuntu-core-16-pi3.img.xz: No such file or directory
        ubuntu-core-16-pi3.img.xz: FAILED open or read
        sha256sum: WARNING: 6 listed files could not be read



        Update:
        Sorry, I missed the 2>&1 part of your question. That portion directs any error messages to the same place as the standard output messages. This page explains that quirky idiom: https://www.brianstorti.com/understanding-shell-script-idiom-redirect/







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Sep 8 at 13:46









        tsteiner

        563




        563



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1073360%2fshasums-and-grep-in-verifying-ubuntu-download%23new-answer', 'question_page');

            );

            Post as a guest













































































            這個網誌中的熱門文章

            How to combine Bézier curves to a surface?

            Carbon dioxide

            Why am i infinitely getting the same tweet with the Twitter Search API?