Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I live in an institute where two proxies work. Lets say they are proxy A and proxy B. A works well for almost all websites, however my institution has blocked many of the essential sites in B using a very poor filtering mechanism. The problem is that A is live for only select periods of time (which is unpredictable), however B remains live 99% of the time. Hence, I use tor-browser for that proxy, which provides me a tunnel to access all the banned websites. Now, every time A is down, I need to go to apt.conf in the etc/apt/ folder and configure the socks proxy of the tor browser there. This obviously takes up most of the time and reopening shell instances again and again is a headache. So, is there any way I could easily switch between proxies using a GUI / shell (and apply them system-wide)in a way similar to that of proxyswitchy extension of chrome.

share|improve this question

We're just talking about manipulating the "HTTP_PROXY" environment variable, right? Depending on what GUI/OS you're using (you didn't mention), there are many ways to set an environment variable.

For example, in Ubuntu/gnome (and maybe others) you could make browser shortcuts for each setting of the variable, as described here under "Launching desktop application with an environment variable"

share|improve this answer

You can set aliases for the environmental variable.

alias p1="export http_proxy=http://proxy1.domain.local:3128"

alias p2="export http_proxy=http://proxy2.domain.local:3128"

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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