Adsense Leaderboard Ad


How to Set the http_proxy Variable in Linux

The following information will teach you how to allow your Linux system to use a proxy server for command line tools like wget and yum.

The http_proxy variable tells the system what proxy server it should used to fetch URLs on the command line.  This allows you to manually download a file via http, https and ftp and also allows most other command line programs to get files from the internet (for example the yum command to update you Linux system).

To set the http_proxy variable just have to assign a value to it like so:

You must give the value in the URL:PORT format like above. Now if you request a resource from the internet on the command line it will work fine.  A simple test would be to fetch our homepage.

After running the above command you should have an index.html file which is our homepage you just downloaded.

If you set the variable like mentioned above it will only work for the current shell. If you close the terminal, log out, or create a new shell (terminal window) the variable will not work.  For it to work on all new shells you must export it, or what is known and make it a global variable, like so:

export http_proxy
or on one line...

http_proxy=; export http_proxy
This will still only be useful for all child shells.  To make this setting survive a reboot you can put the command in your .bashrc file. This will actually set the variable and export it everything you open a shell.

echo "http_proxy=" >> ~/.bashrc
Or you can manually edit the ~/.bashrc file and add it yourself.

Setting it in the ~/.bashrc file is only going to work for the one user who's home directory the .bashrc file resides in.  To make this a global variable for all users place it in the /etc/bashrc file.

echo "http_proxy=; export http_proxy" >> /etc/bashrc


  1. Hello every body.
    I have set my proxy setting in system->prefernces->network proxy. But my firefox is still offline. What should i do

    1. That is a very vague question, there can be 1,000 things that will possibly make your system offline.