How do I display all URLs in a redirect chain?

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











up vote
15
down vote

favorite
5












I'm looking for a way to show all of the URLs in a redirect chain, preferably from the shell. I've found a way to almost do it with curl, but it only shows the first and last URL. I'd like to see all of them.



There must be a way to do this simply, but I can't for the life of me find what it is.



Edit: Since submitting this I've found out how to do it with Chrome (CTRL+SHIFT+I->Network tab). But, I'd still like to know how it can be done from the Linux command line.










share|improve this question



























    up vote
    15
    down vote

    favorite
    5












    I'm looking for a way to show all of the URLs in a redirect chain, preferably from the shell. I've found a way to almost do it with curl, but it only shows the first and last URL. I'd like to see all of them.



    There must be a way to do this simply, but I can't for the life of me find what it is.



    Edit: Since submitting this I've found out how to do it with Chrome (CTRL+SHIFT+I->Network tab). But, I'd still like to know how it can be done from the Linux command line.










    share|improve this question

























      up vote
      15
      down vote

      favorite
      5









      up vote
      15
      down vote

      favorite
      5






      5





      I'm looking for a way to show all of the URLs in a redirect chain, preferably from the shell. I've found a way to almost do it with curl, but it only shows the first and last URL. I'd like to see all of them.



      There must be a way to do this simply, but I can't for the life of me find what it is.



      Edit: Since submitting this I've found out how to do it with Chrome (CTRL+SHIFT+I->Network tab). But, I'd still like to know how it can be done from the Linux command line.










      share|improve this question















      I'm looking for a way to show all of the URLs in a redirect chain, preferably from the shell. I've found a way to almost do it with curl, but it only shows the first and last URL. I'd like to see all of them.



      There must be a way to do this simply, but I can't for the life of me find what it is.



      Edit: Since submitting this I've found out how to do it with Chrome (CTRL+SHIFT+I->Network tab). But, I'd still like to know how it can be done from the Linux command line.







      wget curl






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 37 mins ago

























      asked Jul 14 '15 at 23:32









      felwithe

      178118




      178118




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          20
          down vote



          accepted










          How about simply using wget?



          $ wget http://picasaweb.google.com 2>&1 | grep Location:
          Location: /home [following]
          Location: https://www.google.com/accounts/ServiceLogin?hl=en_US&continue=https%3A%2F%2Fpicasaweb.google.com%2Flh%2Flogin%3Fcontinue%3Dhttps%253A%252F%252Fpicasaweb.google.com%252Fhome&service=lh2&ltmpl=gp&passive=true [following]
          Location: https://accounts.google.com/ServiceLogin?hl=en_US&continue=https%3A%2F%2Fpicasaweb.google.com%2Flh%2Flogin%3Fcontinue%3Dhttps%3A%2F%2Fpicasaweb.google.com%2Fhome&service=lh2&ltmpl=gp&passive=true [following]


          curl -v also shows some info, but looks not as useful as wget.



          $ curl -v -L http://picasaweb.google.com 2>&1 | egrep "^> (Host:|GET)"
          > GET / HTTP/1.1
          > Host: picasaweb.google.com
          > GET /home HTTP/1.1
          > Host: picasaweb.google.com
          > GET /accounts/ServiceLogin?hl=en_US&continue=https%3A%2F%2Fpicasaweb.google.com%2Flh%2Flogin%3Fcontinue%3Dhttps%253A%252F%252Fpicasaweb.google.com%252Fhome&service=lh2&ltmpl=gp&passive=true HTTP/1.1
          > Host: www.google.com
          > GET /ServiceLogin?hl=en_US&continue=https%3A%2F%2Fpicasaweb.google.com%2Flh%2Flogin%3Fcontinue%3Dhttps%253A%252F%252Fpicasaweb.google.com%252Fhome&service=lh2&ltmpl=gp&passive=true HTTP/1.1
          > Host: accounts.google.com





          share|improve this answer




















          • That looks like it'll do it. I'm just curious though, why did you send STDERR to STDOUT?
            – felwithe
            Jul 15 '15 at 10:12






          • 1




            If I'm not mistaken, it will only work for redirection using the location header, not for 301 http codes
            – greg
            Mar 3 '17 at 10:29







          • 1




            I cannot reproduce the wget example. Returns "503: Service Unavailable." - Maybe they are blocking the wget but not the curl http-user-agent? Is this just me?
            – StackzOfZtuff
            Nov 17 '17 at 12:01











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          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: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f216042%2fhow-do-i-display-all-urls-in-a-redirect-chain%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
          20
          down vote



          accepted










          How about simply using wget?



          $ wget http://picasaweb.google.com 2>&1 | grep Location:
          Location: /home [following]
          Location: https://www.google.com/accounts/ServiceLogin?hl=en_US&continue=https%3A%2F%2Fpicasaweb.google.com%2Flh%2Flogin%3Fcontinue%3Dhttps%253A%252F%252Fpicasaweb.google.com%252Fhome&service=lh2&ltmpl=gp&passive=true [following]
          Location: https://accounts.google.com/ServiceLogin?hl=en_US&continue=https%3A%2F%2Fpicasaweb.google.com%2Flh%2Flogin%3Fcontinue%3Dhttps%3A%2F%2Fpicasaweb.google.com%2Fhome&service=lh2&ltmpl=gp&passive=true [following]


          curl -v also shows some info, but looks not as useful as wget.



          $ curl -v -L http://picasaweb.google.com 2>&1 | egrep "^> (Host:|GET)"
          > GET / HTTP/1.1
          > Host: picasaweb.google.com
          > GET /home HTTP/1.1
          > Host: picasaweb.google.com
          > GET /accounts/ServiceLogin?hl=en_US&continue=https%3A%2F%2Fpicasaweb.google.com%2Flh%2Flogin%3Fcontinue%3Dhttps%253A%252F%252Fpicasaweb.google.com%252Fhome&service=lh2&ltmpl=gp&passive=true HTTP/1.1
          > Host: www.google.com
          > GET /ServiceLogin?hl=en_US&continue=https%3A%2F%2Fpicasaweb.google.com%2Flh%2Flogin%3Fcontinue%3Dhttps%253A%252F%252Fpicasaweb.google.com%252Fhome&service=lh2&ltmpl=gp&passive=true HTTP/1.1
          > Host: accounts.google.com





          share|improve this answer




















          • That looks like it'll do it. I'm just curious though, why did you send STDERR to STDOUT?
            – felwithe
            Jul 15 '15 at 10:12






          • 1




            If I'm not mistaken, it will only work for redirection using the location header, not for 301 http codes
            – greg
            Mar 3 '17 at 10:29







          • 1




            I cannot reproduce the wget example. Returns "503: Service Unavailable." - Maybe they are blocking the wget but not the curl http-user-agent? Is this just me?
            – StackzOfZtuff
            Nov 17 '17 at 12:01















          up vote
          20
          down vote



          accepted










          How about simply using wget?



          $ wget http://picasaweb.google.com 2>&1 | grep Location:
          Location: /home [following]
          Location: https://www.google.com/accounts/ServiceLogin?hl=en_US&continue=https%3A%2F%2Fpicasaweb.google.com%2Flh%2Flogin%3Fcontinue%3Dhttps%253A%252F%252Fpicasaweb.google.com%252Fhome&service=lh2&ltmpl=gp&passive=true [following]
          Location: https://accounts.google.com/ServiceLogin?hl=en_US&continue=https%3A%2F%2Fpicasaweb.google.com%2Flh%2Flogin%3Fcontinue%3Dhttps%3A%2F%2Fpicasaweb.google.com%2Fhome&service=lh2&ltmpl=gp&passive=true [following]


          curl -v also shows some info, but looks not as useful as wget.



          $ curl -v -L http://picasaweb.google.com 2>&1 | egrep "^> (Host:|GET)"
          > GET / HTTP/1.1
          > Host: picasaweb.google.com
          > GET /home HTTP/1.1
          > Host: picasaweb.google.com
          > GET /accounts/ServiceLogin?hl=en_US&continue=https%3A%2F%2Fpicasaweb.google.com%2Flh%2Flogin%3Fcontinue%3Dhttps%253A%252F%252Fpicasaweb.google.com%252Fhome&service=lh2&ltmpl=gp&passive=true HTTP/1.1
          > Host: www.google.com
          > GET /ServiceLogin?hl=en_US&continue=https%3A%2F%2Fpicasaweb.google.com%2Flh%2Flogin%3Fcontinue%3Dhttps%253A%252F%252Fpicasaweb.google.com%252Fhome&service=lh2&ltmpl=gp&passive=true HTTP/1.1
          > Host: accounts.google.com





          share|improve this answer




















          • That looks like it'll do it. I'm just curious though, why did you send STDERR to STDOUT?
            – felwithe
            Jul 15 '15 at 10:12






          • 1




            If I'm not mistaken, it will only work for redirection using the location header, not for 301 http codes
            – greg
            Mar 3 '17 at 10:29







          • 1




            I cannot reproduce the wget example. Returns "503: Service Unavailable." - Maybe they are blocking the wget but not the curl http-user-agent? Is this just me?
            – StackzOfZtuff
            Nov 17 '17 at 12:01













          up vote
          20
          down vote



          accepted







          up vote
          20
          down vote



          accepted






          How about simply using wget?



          $ wget http://picasaweb.google.com 2>&1 | grep Location:
          Location: /home [following]
          Location: https://www.google.com/accounts/ServiceLogin?hl=en_US&continue=https%3A%2F%2Fpicasaweb.google.com%2Flh%2Flogin%3Fcontinue%3Dhttps%253A%252F%252Fpicasaweb.google.com%252Fhome&service=lh2&ltmpl=gp&passive=true [following]
          Location: https://accounts.google.com/ServiceLogin?hl=en_US&continue=https%3A%2F%2Fpicasaweb.google.com%2Flh%2Flogin%3Fcontinue%3Dhttps%3A%2F%2Fpicasaweb.google.com%2Fhome&service=lh2&ltmpl=gp&passive=true [following]


          curl -v also shows some info, but looks not as useful as wget.



          $ curl -v -L http://picasaweb.google.com 2>&1 | egrep "^> (Host:|GET)"
          > GET / HTTP/1.1
          > Host: picasaweb.google.com
          > GET /home HTTP/1.1
          > Host: picasaweb.google.com
          > GET /accounts/ServiceLogin?hl=en_US&continue=https%3A%2F%2Fpicasaweb.google.com%2Flh%2Flogin%3Fcontinue%3Dhttps%253A%252F%252Fpicasaweb.google.com%252Fhome&service=lh2&ltmpl=gp&passive=true HTTP/1.1
          > Host: www.google.com
          > GET /ServiceLogin?hl=en_US&continue=https%3A%2F%2Fpicasaweb.google.com%2Flh%2Flogin%3Fcontinue%3Dhttps%253A%252F%252Fpicasaweb.google.com%252Fhome&service=lh2&ltmpl=gp&passive=true HTTP/1.1
          > Host: accounts.google.com





          share|improve this answer












          How about simply using wget?



          $ wget http://picasaweb.google.com 2>&1 | grep Location:
          Location: /home [following]
          Location: https://www.google.com/accounts/ServiceLogin?hl=en_US&continue=https%3A%2F%2Fpicasaweb.google.com%2Flh%2Flogin%3Fcontinue%3Dhttps%253A%252F%252Fpicasaweb.google.com%252Fhome&service=lh2&ltmpl=gp&passive=true [following]
          Location: https://accounts.google.com/ServiceLogin?hl=en_US&continue=https%3A%2F%2Fpicasaweb.google.com%2Flh%2Flogin%3Fcontinue%3Dhttps%3A%2F%2Fpicasaweb.google.com%2Fhome&service=lh2&ltmpl=gp&passive=true [following]


          curl -v also shows some info, but looks not as useful as wget.



          $ curl -v -L http://picasaweb.google.com 2>&1 | egrep "^> (Host:|GET)"
          > GET / HTTP/1.1
          > Host: picasaweb.google.com
          > GET /home HTTP/1.1
          > Host: picasaweb.google.com
          > GET /accounts/ServiceLogin?hl=en_US&continue=https%3A%2F%2Fpicasaweb.google.com%2Flh%2Flogin%3Fcontinue%3Dhttps%253A%252F%252Fpicasaweb.google.com%252Fhome&service=lh2&ltmpl=gp&passive=true HTTP/1.1
          > Host: www.google.com
          > GET /ServiceLogin?hl=en_US&continue=https%3A%2F%2Fpicasaweb.google.com%2Flh%2Flogin%3Fcontinue%3Dhttps%253A%252F%252Fpicasaweb.google.com%252Fhome&service=lh2&ltmpl=gp&passive=true HTTP/1.1
          > Host: accounts.google.com






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jul 15 '15 at 2:37









          yaegashi

          8,01611532




          8,01611532











          • That looks like it'll do it. I'm just curious though, why did you send STDERR to STDOUT?
            – felwithe
            Jul 15 '15 at 10:12






          • 1




            If I'm not mistaken, it will only work for redirection using the location header, not for 301 http codes
            – greg
            Mar 3 '17 at 10:29







          • 1




            I cannot reproduce the wget example. Returns "503: Service Unavailable." - Maybe they are blocking the wget but not the curl http-user-agent? Is this just me?
            – StackzOfZtuff
            Nov 17 '17 at 12:01

















          • That looks like it'll do it. I'm just curious though, why did you send STDERR to STDOUT?
            – felwithe
            Jul 15 '15 at 10:12






          • 1




            If I'm not mistaken, it will only work for redirection using the location header, not for 301 http codes
            – greg
            Mar 3 '17 at 10:29







          • 1




            I cannot reproduce the wget example. Returns "503: Service Unavailable." - Maybe they are blocking the wget but not the curl http-user-agent? Is this just me?
            – StackzOfZtuff
            Nov 17 '17 at 12:01
















          That looks like it'll do it. I'm just curious though, why did you send STDERR to STDOUT?
          – felwithe
          Jul 15 '15 at 10:12




          That looks like it'll do it. I'm just curious though, why did you send STDERR to STDOUT?
          – felwithe
          Jul 15 '15 at 10:12




          1




          1




          If I'm not mistaken, it will only work for redirection using the location header, not for 301 http codes
          – greg
          Mar 3 '17 at 10:29





          If I'm not mistaken, it will only work for redirection using the location header, not for 301 http codes
          – greg
          Mar 3 '17 at 10:29





          1




          1




          I cannot reproduce the wget example. Returns "503: Service Unavailable." - Maybe they are blocking the wget but not the curl http-user-agent? Is this just me?
          – StackzOfZtuff
          Nov 17 '17 at 12:01





          I cannot reproduce the wget example. Returns "503: Service Unavailable." - Maybe they are blocking the wget but not the curl http-user-agent? Is this just me?
          – StackzOfZtuff
          Nov 17 '17 at 12:01


















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f216042%2fhow-do-i-display-all-urls-in-a-redirect-chain%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay