To use a proxy server to access the Internet from a Linux or Unix shell prompt, you can set the http_proxy
environment variable to the proxy server address and port number.
Here is an example of how to set the http_proxy
variable for a HTTP proxy server running on 192.168.1.10
on port 3128
:
export http_proxy=http://192.168.1.10:3128Source:al.wwwutturi.com
This will set the http_proxy
variable for the current shell session. To make the change permanent, you can add the export
line to your Bash profile file, such as ~/.bashrc
or ~/.bash_profile
.
Once the http_proxy
variable is set, you can use most command-line utilities, such as wget
, curl
, and lynx
, to access the Internet through the proxy server.
For example, to download a file using wget
through the proxy server, you can use the following command:
wget -e http_proxy=http://192.168.1.10:3128 http://www.example.com/file.zip
This will download the file file.zip
from http://www.example.com
through the proxy server running on 192.168.1.10
on port 3128
.
If you are using a HTTPS proxy server, you can set the https_proxy
variable in the same way:
export https_proxy=https://192.168.1.10:3128
Keep in mind that some command-line utilities may not support the http_proxy
and https_proxy
variables. In such cases, you may need to use a different method to access the Internet through a proxy server.