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
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
but I always receive :
P.S. Also I tried HTTP without '',now I putted for curiosity
shell-script awk wget http url
add a comment |
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
but I always receive :
P.S. Also I tried HTTP without '',now I putted for curiosity
shell-script awk wget http url
You left out2>&1
from thewget ...
line, that makes the output to stderr go to the pipe andgrep
. 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
add a comment |
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
but I always receive :
P.S. Also I tried HTTP without '',now I putted for curiosity
shell-script awk wget http url
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
but I always receive :
P.S. Also I tried HTTP without '',now I putted for curiosity
shell-script awk wget http url
shell-script awk wget http url
edited Dec 14 '13 at 11:16
Phil_Charly
asked Dec 14 '13 at 9:59
Phil_CharlyPhil_Charly
863514
863514
You left out2>&1
from thewget ...
line, that makes the output to stderr go to the pipe andgrep
. 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
add a comment |
You left out2>&1
from thewget ...
line, that makes the output to stderr go to the pipe andgrep
. 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
add a comment |
2 Answers
2
active
oldest
votes
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
add a comment |
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?"
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
add a comment |
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
add a comment |
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
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
edited May 27 '15 at 21:03
David Kennedy
95081738
95081738
answered Dec 14 '13 at 10:37
user37323
add a comment |
add a comment |
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?"
add a comment |
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?"
add a comment |
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?"
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?"
edited Dec 14 '13 at 11:29
answered Dec 14 '13 at 10:54
ZeldaZelda
4,8521526
4,8521526
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
You left out
2>&1
from thewget ...
line, that makes the output to stderr go to the pipe andgrep
. 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