Proxy settings in the console

Yes, and the easy way! I was tired of having things pending [yes, I am lazy by default to do those certain little jobs that bother us all in the console], such as setting the proxy in the console because a certain application was looking for certain plugins on its developer's site ...

Going a bit and studying the environment variables I made a small script-quote that I dropped in / usr / bin /, so that it would set the proxy settings every time I needed it without much further complication.

Here is my mental note, it is called "proxy_settings", it must be copied to / usr / bin /, it has execute permissions [chmod 755], and its code is as follows:

#! / bin / bash function do_proxy () {echo -n "Proxy:" read -e internet_proxy echo -n "Port:" read -e proxy_port echo -n "User:" read -e username echo -n "Pass: "read -es password export http_proxy =" http: // $ username: $ password @ $ internet_proxy: $ proxy_port / "export https_proxy =" http: // $ username: $ password @ $ internet_proxy: $ proxy_port / "export ftp_proxy = "http: // $ username: $ password @ $ internet_proxy: $ proxy_port /" export no_proxy = "localhost, 127.0.0.1, localaddress, .localdomain.com" echo -e "\ nProxy environment variable set \ n"} function undo_proxy () {unset http_proxy unset https_proxy unset ftp_proxy echo -e "\ nProxy environment variable removed \ n"} case "$ 1" in on) do_proxy ;; off) undo_proxy ;; *) echo -e "\ nUsage: proxy_settings {on | off} \ n" exit 1 esac exit 0

Modify it and use it to your liking. A salu2 and until next time!


Leave a Comment

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

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   monk said

    Eii, very interesting the article and your script. Although if you allow me, if you explained with which command it is executed, how the script stops so that it returns to normal, beginners would understand it better. In my case it would help me.

    Thanks

  2.   koratsuki said

    @monk: Very easy, only in your terminal you run proxy_settingss and the script will tell you what steps you should follow to carry out your task. In this case with "proxy_settings on" it will ask you for the data of your proxy settings, that is, your proxy ip, port, user and password, then set the variables, open the browser and voila!

    And you are absolutely right, I forgot to explain how the script worked. My apologies…

  3.   adiazc87 said

    Thank you very much, good article, I'll take it 🙂

  4.   jerrykpg said

    Very good! Thanks for sharing!!! Cheers!

  5.   Irwing Casana Gonzalez said

    Very good. I would like to know if I can use it with manjaro