Digital & Information Technology

How to Configure Proxy Settings in Linux

Posted updated January 26, 2021

Here are two different ways to configure Linux to recognize a proxy server or proxy configuration file.

1. Export Command for Proxy Environment Variables

Personal kneeling in stone tunnel, photo credit jondoe via flickr
photo credit: jondoe

Use the following commands to configure your proxy for http and ftp traffic on the command line
export http_proxy=http://:

export ftp_proxy=http://:

If your proxy requires login/authentication, you can use the format:
export http_proxy=http://username:password@::

To have this applied every time you log in, place these lines in your .bashrc in your home (~) directory.
export http_proxy=http://:
export ftp_proxy=http://:

Example Proxy Settings Using the Above Instructions

Using an example proxy port 3128

Add these lines to etc/environment or shell initialization like ~/.bashrc

http_proxy= 3128:3128/
https_proxy= 3128:3128/

Temporary proxy settings

Perhaps you need to set a proxy temporarily and remove it later. These sets of commands can be run or put in a script to run when the proxy should be set up and then removed later.

# set proxy
export http_proxy=
export https_proxy=
Unset (remove proxy settings)
# remove proxy
unset http_proxy
unset https_proxy

2. Network Proxy Settings

For GNOME, go to Computer->Desktop Preferences->Network Proxy
For KDE desktop manager, you can get to the network proxy settings under System Settings > Network Settings > Proxy

In the setting, you can configure either by your proxy server and port, by the network, or a file via a URL/file location (e.g. http://myproxyserver:port/proxyfile.pac) .

These settings work with most other applications (e.g. other browsers like Chrome, OS commands).

Program/Application Level

Some applications and commands need to be configured individually. Below are common examples.


You can manually set up the Firefox proxy in Options. Go to the General tab then Network Settings.

In older versions, go to Options > Advanced > Settings.

Fedora – Yum Package Manager

yum proxy settings can be found in the file system at

Add a line to the file with the following information:
The next time you run yum, it will pick up that proxy.

For Ubuntu

Here is a similar how to article on configuring proxy settings in Ubuntu covering Synaptic Package Manager, Gnome, apt-get, and Firefox.

To set the proxy used by Aptitude package manager:

Create a new file ‘proxy.conf’ under the ‘/etc/apt/apt.conf.d/’ directory, and then add the lines shown below. For example:

sudo nano /etc/apt/apt.conf.d/proxy.conf
# In editor, add these lines
Acquire {
  HTTP::proxy "";
  HTTPS::proxy "";

By Justin Tung

Servant of the public as a communications and IT jack of all trades. Always willingly to fundraise and volunteer for the greater good.

9 replies on “How to Configure Proxy Settings in Linux”

hi frostwong, that’s an awesome question with several answers.

First we have to understand http_proxy and ftp_proxy are *environment variables* used by the shell (e.g. bash, sh) that can be set on the local user level and global level. The variables are an easy way to share configuration settings between multiple Linux applications and processes. The export command sets those variables.

You could set the shell environment variables using the export command in various files such as ~/.bash_profile or ~/.profile or /etc/profile (the exact names of these files may vary with the Linux distribution). By adding those export statements to the profile files, the variables will be set up for your local user session or all global sessions.

Remember some applications like the Fedora yum package manager store their own proxy settings in an application file, so you can modify the setting in that application’s configuration file.

Learn more about environment variables and other system configuration files here:
The article explains them from a general Linux perspective.


Please, don’t call a “system-wide proxy” once you need to configure every single application/library to read from an environment variable. Windows have a system-wide proxy, Linux does not.


Fiddler2 runs with mono on Linux. You can CATCH all your system net activity and process it the way you want. To add a system-wide proxy use a syntax like:
if (oSession.HostnameIs(“”)) { // OR define a button to enable/disable
oSession[“x-OverrideGateway”] = “socks=”; // or the IP you use, local or remote


Not really Dwight, /etc/environment is just a shared “.*rc” file. So it still relies on the programmer to check the HTTP_PROXYs env vars. A system-wide proxy can only be accomplished by hooking in the kernel’s netfilter and creating a rerouting rule. One can use iptables to do so.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.