For bash commands you have to set the proxy seperately. For this, you have to set a environment variable, e.g.:
ping google.com # can't resolve, no proxy set
ping google.com # works, proxy set for this bash session.
Replace the address and the port with your proxy configuration. If you're always behind this proxy, add the
export http_proxy... command to
~/.bashrc so it gets executed every time you start a new bash session.
Or to execute a single command with proxy settings and without setting environment variables, use
env http_proxy=proxy.example.com:1234 ping google.com
sudo env http_proxy=proxy.example.com:1234 apt-get install cowsay
To use other services, e.g. HTTPS or FTP you have to set different variables: