I am attempting to download a file from a hidden service using curl. I downloaded the Tor client and launched it and from another terminal executed this:

curl --socks5 socks5:// https://check.torproject.org > /tmp/output.txt

After listing the contents of tmp I catted the file along with grepping for 'browser'. I found congratulations this browser is configured to use Tor. However when I attempt to connect to a hidden service it fails to resolve the hostname which i checked within Tor browser and it loads. I tried using --socks5-hostname localhost:9050 and it downloaded the page just fine from the hidden service. Why is this?

2 Answers 2


According to man curl:

--socks5 <host[:port]>
       Use the specified SOCKS5 proxy  -  but  resolve  the  host  name

This means --socks5 will use local resolver which CANNOT resolve .onion names UNLESS you configured it to do so and configured tor relay to do IP address allocation for hidden services.

--socks5-hostname has this information in the man page:

--socks5-hostname <host[:port]>
       Use  the  specified  SOCKS5 proxy (and let the proxy resolve the
       host name).

This lets tor and its socks proxy do the resolution and handle the .onion name hence the connection succeeds.


Install torsocks. This is a wrapper that will allow command line tools like curl to use the Tor service in Linux.


torsocks curl yz7lpwfhhzcdyc5y.onion

  • But, torsocks will install/run a tor executable as well. Check that you don't have conflicts. I spent a day learning this.
    – LDysic
    Sep 25, 2019 at 22:39

You must log in to answer this question.

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