Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set up a proxy via bash shell?

I set up a proxy on Mac via System Preferences -> Network -> Advanced -> Proxies.

Is that possible to do the same programatically via bash shell?

like image 801
Misha Moroshko Avatar asked Dec 29 '11 10:12

Misha Moroshko


People also ask

How do I manually set a proxy in Linux?

To do so, set the http_proxy and https_proxy variables, which tells the switch the address of the proxy server to use to fetch URLs on the command line. This is useful for programs such as apt / apt-get , curl and wget , which can all use this proxy. In a terminal, create a new file in the /etc/profile. d/ directory.


1 Answers

You can put this in your .profile or .bash_profile or run manually on a command line:

export http_proxy=http://proxy.server.com:@aproxy:portnumber
export https_proxy=https://proxy.server.com:@aproxy:portnumber

It's also common to not use the proxy for the local connections

export no_proxy=localhost,127.0.0.0/8,*.local
like image 174
maxjackie Avatar answered Sep 20 '22 09:09

maxjackie