Okay, I have to google this information every-time I need it, to so am going to blog it, so that I know exactly where to look for it 🙂
Setting up a proxy from the GUI on you browser or system does not always work for command line utilities like apt-get, yum, wget or customer bash scripts etc…
So here is how to setup proxy for CLI from CLI, assuming your proxy server is proxy.example.com (IP 192.168.2.252) and port 3128.
If you need authentication:
If you need to unset it:
If need to check if there is already proxy configured:
This change is non-persistent, meaning you will have to redo it after reboot. If you need the configuration to be persistent across reboots. Add the above command to your system /etc/bash.bashrc.
You can also add a ftp proxy using a similar entry. Ofcourse check with your admin if the proxy supports ftp.
Hope this helps someone. Cheers!