1

How to set a proxy for terminal without exporting the environment variable?

I am using a Ubuntu machine and I would like to do that?

If it not possible, are there any apps to help me do that?

Thank you.

1
  • be more precise, you have two options, either using iptables or using a default configuration. it's missing what you want to afford Commented Sep 12, 2022 at 17:09

1 Answer 1

0

You can always set up the variable just for the command you want to run, for instance, you can do the following:

$ HTTPS_PROXY=http://localhost:3128 curl https://external.domain.com/ 

And curl will use the HTTPS_PROXY defined right there and only once.

If you want to set the environment variable, it will work for the whole Terminal Session, but not for any other user/system - it won't affect your cron jobs, for instance.

3
  • This is a very helpful answer and I am very thankful. Commented Oct 31, 2022 at 22:21
  • This doesn't work on macOS terminal though.. Commented Oct 31, 2022 at 22:21
  • Are you using the default zsh? that's just a lame shel IMHO, change the default to bash. Commented Nov 2, 2022 at 12:05

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.