I am running some programs in Bash in Ubuntu.

The programs download something using network sockets. Their README file says they can be used with tor, and I hope to change the external IP address by using tor with the programs.

I have tried to look up how to use tor with a program in shell on the Internet including tor's official website, but I haven't found a step-by-step explanation. Could you show me how to use a program with tor in Bash, and maybe also point to some resources for learning? (I have some but not much knowledge about networks and network programming.) Thanks.

2 Answers 2


From the README:

The getxbook program downloads books anonymously. Using it will still result in your IP address being logged (use torify to stop this)...

torify is tool that attempts to wrap your terminal command in a Tor session. There's a good tutorial on what you need to do, here. Then it's just a case of running:

torify <your_command>
  • Thanks. Do torsocks and torify do the same thing? If yes, how are they compared to each other?
    – Tim
    Apr 10, 2016 at 2:20
  • From the torify manual page (i.e. man torify): "torify - wrapper for torsocks and tor". From the torsocks manual page (i.e. man torsocks): "torsocks - Shell wrapper to simplify the use of the torsocks(8) library to transparently allow an application to use a SOCKS proxy." (The torsocks library is one of the libraries used by the main Tor program.) Apr 11, 2016 at 8:21

To add to what mentioned earlier I would like to say that you can use sudo command at the beginning of the command:

sudo torify <command>

but don't use torify at the beginning

  • There shouldn't be any reason to use sudo here, it's likely that you have something configured wrong.
    – Steve
    Nov 14, 2022 at 20:55

You must log in to answer this question.

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