8

when a try use a wget in a https site, I need add

 wget --no-check-certificate https://...

how I can use a more short argument?
for don't use this very long string.

7

From what I can see there's no shorter version of the --no-check-certificate option.

So you could always make an alias to it. alias wgetncc='wget --no-check-certificate' (Change 'wgetncc' to whatever you please.)

Type that into the command line and after that, every time you run wgetncc it will be a shortcut to wget --no-check-certificate

If you want this to be an alias every time you login, you will have to place this in an alias file or something equivalent. It depends on the shell you are using.

  • 1
    Your accepted answer is naturally what the OP was looking for, but I'm interested in knowing why one would simply assume he was talking about Wget on Linux and not Windows, and thus recommend alias? – Karan Nov 21 '12 at 21:29
  • I didn't know for sure. But my guess was formulated from two different factors: 1) Most of the time wget isn't used on Windows. 2) OP's other questions are about GNU/Linux. So that is why I assumed he was talking about GNU/Linux. – 0xAether Nov 21 '12 at 21:48
  • Hmm, I guess that's fine although I wish people would specify their operating environment and other relevant details instead of making people guess and possibly wasting their time. – Karan Nov 21 '12 at 21:57
  • @Karan just going to point out that no one ever assumes wget even exists on windows. It is typically used in bourne shell or other unix-y shells. I compiled wget for windows, but I almost always run it within MSYS bash or a cygwin shell. – Wyatt8740 Feb 24 '16 at 15:32
  • 1
    INCORRECT: As of 2017 (and earlier?) add check_certificate=off to ~/.wgetrc – clearlight Jan 9 '18 at 19:44
22

Try this: (assumes *nix)

echo "check_certificate = off" >> ~/.wgetrc

Then ever after, wget will act like you specified the --no-check-certificate switch. More info at https://www.gnu.org/software/wget/manual/wget.html#Wgetrc-Syntax or https://www.gnu.org/software/wget/manual/wget.html#Wgetrc-Location

  • A thing to note: don't add comments in the same line as the directive itself. check_certificate=off # --no-check-certificate will result in syntax error as the config won't load properly. Other than that, omitting spaces around the assignment sign is OK. – user373230 Jun 19 '17 at 16:07
  • 1
    This even works with Windows ports of wget. 👍 – Synetech May 4 '18 at 2:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.