How To Use Proxy On Linux Command Line?

​You have heard about a proxy sometimes but what is a proxy and how it works? The proxy provides many functions like anonymous navigation, access to geographically restricted content, or filter some content. Well basically a proxy server is a computer that acts as an intermediate between your PC and the internet and all the traffic looks like the Proxy server did it.  

how proxy works

​For example, If you are using a proxy and you send a request to Google your request is processed by the proxy server then It sends a request to Google. The IP address that Google catches is the IP address of the proxy server and that makes your IP  unknown to the Google server. Many Schools or Libraries and other places use proxies to block web pages like Social Networks. You send a request for Facebook then the proxy server filters the ip address for the website and returns a notification that the domain is blocked.

access restricted content from proxy server

​In another post we talk about VPN, but What is the difference between a proxy and a VPN? Well, the VPN (Virtual Private Network) creates an encrypted tunnel between the server and your PC, but according to the provider, this can save some registries about your activity. A good VPN provider tries to avoid saving your activity. To use a VPN you must have a VPN client while to use a proxy you only need to do some configurations. Also, you can use a VPN to access to restricted geographic content from services like Netflix, Youtube, and others. But if you want to know more we have an article dedicated to VPN.

Also Read – What Is VPN Connection?

How to set a proxy?

​If you want to set a proxy you need to edit the file /etc/environment sudo nano /etc/environment ​and then put these lines - http_proxy=http://10.1.1.1:3128/
https_proxy=http://10.1.1.1:3128/
ftp_proxy=http://10.1.1.1:3128/
no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
HTTP_PROXY=http://10.1.1.1:3128/
HTTPS_PROXY=10.1.1.1:3128/
FTP_PROXY=10.1.1.1:3128/
NO_PROXY="localhost,127.0.0.1,localaddress,.localdomain.com" ​If you also want to use a proxy to apt-get  you need to add this lines - Acquire::http::proxy "http://10.1.1.1:3128";
Acquire::ftp::proxy "http://10.1.1.1:3128";
Acquire::https::proxy "http://10.1.1.1:3128";
Where
http_proxy is the system variable that you want to edit
http://10.1.1.1:3128 is the IP address of your proxy server and its port ​If you are scared to the terminal you also can go to the system settings -> network -> network proxy and add your configuration.

Also Read – How To Setup VPN In Linux?

Conclusion

​We hope that the article will be useful to you. A proxy server is a good option if you want to browse anonymously, these days the privacy is something that people don’t care, we are owners of our data and is our obligation to take care of it. To the end of the day, the use of a VPN or a Proxy depends on you and your needs. So there you have it. Let me know your thoughts in the comment section below.

Sohail
Sohail

Mohd Sohail is a web developer and a Linux sysAdmin. He also loves to write how-to articles, applications reviews and loves to use new Linux distributions.

Articles: 859

3 Comments

  1. Hi Friend,
    I have added the above lines ( replacing my proxy:port ) , but still unable to use curl command to reach the internet sites. Please let me know how to make these setting activated.

  2. my hostel wifi works when we enter the proxy and port (which i inserted in my browser and its working fine) but in terminal i am unable to update anything

Leave a Reply

Your email address will not be published. Required fields are marked *