0

Who does not often have the following problem?

You copy an URL from your Browser to paste in on the console to use it for ping (or other commands) that don't accept a hostname or ip with a leading "http(s)://"

How do you get rid of this the easiest? Or just don't copy it from your URL-Bar?

ping https://somedomain.org

ping: unknown host https://somedomain.org

3 Answers 3

1

Work around it

If you don't copy the whole URL but leave out the first character, you just have to enter:

ping <missing first character> CTRL-V
1

Show the leading protocol in the URL bar

Go to your Advanced Settings in Firefox:

 `about:config`

Search for

browser.urlbar.trimURLs;false

And set this to false

Now you see the full URL again and don't copy the http:// any more.

Source: https://www.cnet.com/how-to/how-to-show-the-full-url-in-firefox/

1

Wrapper Function

Write a function ing that deletes the leading protocol part and calls ping with the modified argument:

function ing { u=$1; shift; ping "$(echo "$u" | sed 's#^[httpsftp]\+://##; s#/$##')" $@; }

Put this in your ~/.bashrc file and from now on you can always use ing instead of ping to ignore the protocoll part:

ing http://somedomain.org

(I use ing as function name, so I can easily edit the last line).

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .