How to Resolve the “curl:(6) Could not resolve host”?

Mohammad IsmailMohammad Ismail
1 min read

Table of contents

There may be numerous causes which will trigger this error. This section shall not only elaborate on what those reasons are but also explain how to resolve this issue.

  1. Syntactical Error : The first and foremost cause of this error is syntax error which if were typing a misspelled which is also occurred error.

curl-Could-not-resolve-host-1.png

Solution is just correct URL and request again.

  1. There is an easy way to make everything work with one command which saves me when nothing else works.
  -  Just type this command with sudo 

  -  sudo dhclient  
  1. DNS Nameserver error :A simple solution to this problem is to add the URL`s nameservers to a file and save it. To add a nameserver first open the file with this command in terminal.
  -  $ sudo nano /etc/resolv.conf

This will open the file and add this nameservers to the file using the following format:

  - nameserver   8.8.8.8
  - nameserver   8.8.4.4

now save it and restart the machine or update the terminal.

0
Subscribe to my newsletter

Read articles from Mohammad Ismail directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Mohammad Ismail
Mohammad Ismail