How to Configure proxy server in Linux?

How To Use Proxy Server To Access Internet at Shell Prompt With
I‘m behind a squid proxy server. How do I access internet via proxy server when I use wget, lynx and other utilities from a shell prompt on a Linux or Unix-like systems?
Linux and UNIX-like systems has environment variable called http_proxy. It allows you to connect text based session and/or applications via the proxy server. All you need is proxy server IP address (URL) and port values. This variable is almost used by all utilities such as elinks, lynx, wget, curl and others commands.

Set http_proxy shell variable on Linux/OS X/Unix bash shell

Type the following command to set proxy server:
$ export http_proxy=
$ export http_proxy=
$ export http_proxy=
If the proxy server requires a username and password then add these to the URL. For example, to include the username foo and the password bar:
$ export http_proxy= protected]:port/
$ export http_proxy= protected]:3128/
$ export http_proxy= protected]:3128/

How do I setup proxy variable for all users?

To setup the proxy environment variable as a global variable, open /etc/profile file:
# vi /etc/profile
Add the following information:
export http_proxy=
OR
Save and close the file.

A note about enabling proxy access to a specific user

To enable proxy access for a specific user, add the lines user shell profile. For the default bash shell, the profile is the file .bash_profile. For example, enable proxy access for a specifc user called vivek, type:
$ vi $HOME/.bash_profile
OR
# vi /home/vivek/.bash_profile
Append the following line:
Save and close the file.

How do I use password protected proxy server using various command line options?

You can simply use wget command as follows:
$ wget -proxy-user=USERNAME -proxy-password=PASSWORD
Lynx command has the following syntax:

Source: www.cyberciti.biz

Related posts:

  1. What is proxy server in Linux?
  2. Configuring proxy server in Windows
  3. How to Configure proxy server in Windows?