Type URL and show HTTP status The Next CEO of Stack OverflowSet a network range in the no_proxy environment variableWGET - Authenticating root AND all children foldersWget out of memory error kills processUsing df and trying to awk a specific columnHow to download files without full URL?Wget can't download filesGetting URL address from file and check HTTP codeHTTP status code for deprecated URLLogging full HTTP url requestsGET via wget or cURL gives a limited response

Unreliable Magic - Is it worth it?

What does "Its cash flow is deeply negative" mean?

Is HostGator storing my password in plaintext?

Is it a good idea to use COLUMN AS (left([Another_Column],(4)) instead of LEFT in the select?

How can I get through very long and very dry, but also very useful technical documents when learning a new tool?

Trouble understanding the speech of overseas colleagues

What makes a siege story/plot interesting?

Why were Madagascar and New Zealand discovered so late?

Was a professor correct to chastise me for writing "Prof. X" rather than "Professor X"?

Can the Reverse Gravity spell affect the Meteor Swarm spell?

How can I open an app using Terminal?

Does it take more energy to get to Venus or to Mars?

Does the Brexit deal have to be agreed by both Houses?

Inappropriate reference requests from Journal reviewers

Is it safe to use c_str() on a temporary string?

How do I go from 300 unfinished/half written blog posts, to published posts?

Anatomically Correct Strange Women In Ponds Distributing Swords

Error when running sfdx update to 7.1.3 then sfdx push errors

Go Pregnant or Go Home

How to write papers efficiently when English isn't my first language?

The King's new dress

How do we know the LHC results are robust?

Why didn't Khan get resurrected in the Genesis Explosion?

Rotate a column



Type URL and show HTTP status



The Next CEO of Stack OverflowSet a network range in the no_proxy environment variableWGET - Authenticating root AND all children foldersWget out of memory error kills processUsing df and trying to awk a specific columnHow to download files without full URL?Wget can't download filesGetting URL address from file and check HTTP codeHTTP status code for deprecated URLLogging full HTTP url requestsGET via wget or cURL gives a limited response










1















I want to make a shell script where I type an url and it returns me the status code.So far I've tested wget is there any other cause it has the tendency to save whatever you run. Then I tried to some kind awk the output but it doesn't do you have any advices.




Edit for Zelda:
I tried the first one



enter image description here



but I always receive :
enter image description here



P.S. Also I tried HTTP without '',now I putted for curiosity










share|improve this question
























  • You left out 2>&1 from the wget ... line, that makes the output to stderr go to the pipe and grep. Quotes around HTTP not needed.

    – Zelda
    Dec 14 '13 at 11:26












  • Oops, thx very much now it works

    – Phil_Charly
    Dec 14 '13 at 11:36















1















I want to make a shell script where I type an url and it returns me the status code.So far I've tested wget is there any other cause it has the tendency to save whatever you run. Then I tried to some kind awk the output but it doesn't do you have any advices.




Edit for Zelda:
I tried the first one



enter image description here



but I always receive :
enter image description here



P.S. Also I tried HTTP without '',now I putted for curiosity










share|improve this question
























  • You left out 2>&1 from the wget ... line, that makes the output to stderr go to the pipe and grep. Quotes around HTTP not needed.

    – Zelda
    Dec 14 '13 at 11:26












  • Oops, thx very much now it works

    – Phil_Charly
    Dec 14 '13 at 11:36













1












1








1








I want to make a shell script where I type an url and it returns me the status code.So far I've tested wget is there any other cause it has the tendency to save whatever you run. Then I tried to some kind awk the output but it doesn't do you have any advices.




Edit for Zelda:
I tried the first one



enter image description here



but I always receive :
enter image description here



P.S. Also I tried HTTP without '',now I putted for curiosity










share|improve this question
















I want to make a shell script where I type an url and it returns me the status code.So far I've tested wget is there any other cause it has the tendency to save whatever you run. Then I tried to some kind awk the output but it doesn't do you have any advices.




Edit for Zelda:
I tried the first one



enter image description here



but I always receive :
enter image description here



P.S. Also I tried HTTP without '',now I putted for curiosity







shell-script awk wget http url






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 14 '13 at 11:16







Phil_Charly

















asked Dec 14 '13 at 9:59









Phil_CharlyPhil_Charly

863514




863514












  • You left out 2>&1 from the wget ... line, that makes the output to stderr go to the pipe and grep. Quotes around HTTP not needed.

    – Zelda
    Dec 14 '13 at 11:26












  • Oops, thx very much now it works

    – Phil_Charly
    Dec 14 '13 at 11:36

















  • You left out 2>&1 from the wget ... line, that makes the output to stderr go to the pipe and grep. Quotes around HTTP not needed.

    – Zelda
    Dec 14 '13 at 11:26












  • Oops, thx very much now it works

    – Phil_Charly
    Dec 14 '13 at 11:36
















You left out 2>&1 from the wget ... line, that makes the output to stderr go to the pipe and grep. Quotes around HTTP not needed.

– Zelda
Dec 14 '13 at 11:26






You left out 2>&1 from the wget ... line, that makes the output to stderr go to the pipe and grep. Quotes around HTTP not needed.

– Zelda
Dec 14 '13 at 11:26














Oops, thx very much now it works

– Phil_Charly
Dec 14 '13 at 11:36





Oops, thx very much now it works

– Phil_Charly
Dec 14 '13 at 11:36










2 Answers
2






active

oldest

votes


















9














You can simply use curl for it. I have written a simple script for it.



url=$1
curl -sL $url -w "%http_code %url_effective\n" "URL" -o /dev/null


Where URL is your URL which you have to test output will gives you status.



Example



image showing status for URL






share|improve this answer
































    4














    You can just stick with wget:



    wget -O /dev/null http://unix.stackexchange.com 2>&1 | grep -F HTTP


    that gives you:



    HTTP request sent, awaiting response... 200 OK


    which you can further trim with cut:



    wget -O /dev/null http://unix.stackexchange.com 2>&1 | grep -F HTTP | cut -d ' ' -f 6


    If the url does not exist, then there is no output.



    With query for url:



    echo "give your url"
    read url
    wget -O /dev/null $url 2>&1 | grep -F HTTP
    echo "ok?"





    share|improve this answer

























      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',
      autoActivateHeartbeat: false,
      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%2f105134%2ftype-url-and-show-http-status%23new-answer', 'question_page');

      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      9














      You can simply use curl for it. I have written a simple script for it.



      url=$1
      curl -sL $url -w "%http_code %url_effective\n" "URL" -o /dev/null


      Where URL is your URL which you have to test output will gives you status.



      Example



      image showing status for URL






      share|improve this answer





























        9














        You can simply use curl for it. I have written a simple script for it.



        url=$1
        curl -sL $url -w "%http_code %url_effective\n" "URL" -o /dev/null


        Where URL is your URL which you have to test output will gives you status.



        Example



        image showing status for URL






        share|improve this answer



























          9












          9








          9







          You can simply use curl for it. I have written a simple script for it.



          url=$1
          curl -sL $url -w "%http_code %url_effective\n" "URL" -o /dev/null


          Where URL is your URL which you have to test output will gives you status.



          Example



          image showing status for URL






          share|improve this answer















          You can simply use curl for it. I have written a simple script for it.



          url=$1
          curl -sL $url -w "%http_code %url_effective\n" "URL" -o /dev/null


          Where URL is your URL which you have to test output will gives you status.



          Example



          image showing status for URL







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited May 27 '15 at 21:03









          David Kennedy

          95081738




          95081738










          answered Dec 14 '13 at 10:37







          user37323






























              4














              You can just stick with wget:



              wget -O /dev/null http://unix.stackexchange.com 2>&1 | grep -F HTTP


              that gives you:



              HTTP request sent, awaiting response... 200 OK


              which you can further trim with cut:



              wget -O /dev/null http://unix.stackexchange.com 2>&1 | grep -F HTTP | cut -d ' ' -f 6


              If the url does not exist, then there is no output.



              With query for url:



              echo "give your url"
              read url
              wget -O /dev/null $url 2>&1 | grep -F HTTP
              echo "ok?"





              share|improve this answer





























                4














                You can just stick with wget:



                wget -O /dev/null http://unix.stackexchange.com 2>&1 | grep -F HTTP


                that gives you:



                HTTP request sent, awaiting response... 200 OK


                which you can further trim with cut:



                wget -O /dev/null http://unix.stackexchange.com 2>&1 | grep -F HTTP | cut -d ' ' -f 6


                If the url does not exist, then there is no output.



                With query for url:



                echo "give your url"
                read url
                wget -O /dev/null $url 2>&1 | grep -F HTTP
                echo "ok?"





                share|improve this answer



























                  4












                  4








                  4







                  You can just stick with wget:



                  wget -O /dev/null http://unix.stackexchange.com 2>&1 | grep -F HTTP


                  that gives you:



                  HTTP request sent, awaiting response... 200 OK


                  which you can further trim with cut:



                  wget -O /dev/null http://unix.stackexchange.com 2>&1 | grep -F HTTP | cut -d ' ' -f 6


                  If the url does not exist, then there is no output.



                  With query for url:



                  echo "give your url"
                  read url
                  wget -O /dev/null $url 2>&1 | grep -F HTTP
                  echo "ok?"





                  share|improve this answer















                  You can just stick with wget:



                  wget -O /dev/null http://unix.stackexchange.com 2>&1 | grep -F HTTP


                  that gives you:



                  HTTP request sent, awaiting response... 200 OK


                  which you can further trim with cut:



                  wget -O /dev/null http://unix.stackexchange.com 2>&1 | grep -F HTTP | cut -d ' ' -f 6


                  If the url does not exist, then there is no output.



                  With query for url:



                  echo "give your url"
                  read url
                  wget -O /dev/null $url 2>&1 | grep -F HTTP
                  echo "ok?"






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Dec 14 '13 at 11:29

























                  answered Dec 14 '13 at 10:54









                  ZeldaZelda

                  4,8521526




                  4,8521526



























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid


                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.

                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f105134%2ftype-url-and-show-http-status%23new-answer', 'question_page');

                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

                      Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

                      Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.