Getting started with Linux: use command lines to change system proxy settings in Ubuntu

Source: Internet
Author: User
Problem: I often need to change the system proxy settings in Ubuntu, but I don't want to click "system settings"-& gt; "network"-& gt; through the tedious GUI menu; "network proxy ". Is there a more convenient way to change proxy settings on the desktop in the command line? In Ubuntu for the desktop version, its desktop environment settings, including system proxy settings, are all stored in the DConf database, which is a simple key-Value Pair storage. If you want to modify the desktop properties through the system settings menu, the changes will be permanently stored in the DCo

Problem: I often need to change the system proxy settings in Ubuntu, but I do not want to click "system settings"-> "network"-> "network proxy" through the tedious GUI menu ". Is there a more convenient way to change proxy settings on the desktop in the command line?

In Ubuntu for the desktop version, its desktop environment settings, including system proxy settings, are all stored in the DConf database, which is a simple key-Value Pair storage. If you want to modify the desktop properties through the system settings menu, the changes will be permanently stored in the DConf database at the backend. In Ubuntu, there are two ways to change the DConf Database: Image-based user interface and non-graphical user interface. System settings ordconf-editorIs a graphical method to access the DConf database, andgsettingsOrdconfIs a command line tool that can change the database.

The following describes how to usegsettingsChange the system proxy settings from the command line.

gsettingsThe basic usage of read/write specific Dconf settings is as follows:

Change DConf settings:

  1. $ gsettings set

Read DConf settings:

  1. $ gsettings get

 

Use the command line to change the system proxy settings to manual

The commands in Ubuntu for the desktop version change the HTTP proxy to "my.proxy.com: 8000 ".

  1. $ gsettings set org.gnome.system.proxy.http host 'my.proxy.com'
  2. $ gsettings set org.gnome.system.proxy.http port 8000
  3. $ gsettings set org.gnome.system.proxy mode 'manual'

If you want to change the HTTPS/FTP proxy to manual, use these commands:

  1. $ gsettings set org.gnome.system.proxy.https host 'my.proxy.com'
  2. $ gsettings set org.gnome.system.proxy.https port 8000
  3. $ gsettings set org.gnome.system.proxy.ftp host 'my.proxy.com'
  4. $ gsettings set org.gnome.system.proxy.ftp port 8000

Set the socket host to manual:

  1. $ gsettings set org.gnome.system.proxy.socks host 'my.proxy.com'
  2. $ gsettings set org.gnome.system.proxy.socks port 8000

The above changes only apply to the current desktop user. If you want to change the settings using the proxy within the system, add sudo in front of the gsettings command. For example:

  1. $ sudo gsettings set org.gnome.system.proxy.http host 'my.proxy.com'
  2. $ sudo gsettings set org.gnome.system.proxy.http port 8000
  3. $ sudo gsettings set org.gnome.system.proxy mode 'manual'

 

In the command line, change the system proxy settings to automatic

If you are using the automatic configuration proxy (proxy auto configuration, PAC), enter the following command to change to PAC.

  1. $ gsettings set org.gnome.system.proxy mode 'auto'
  2. $ gsettings set org.gnome.system.proxy autoconfig-url http://my.proxy.com/autoproxy.pac

 

Clear system proxy settings in the command line

Finally, clear all "manual/automatic" proxy settings and restore to "No proxy settings:

  1. $ gsettings set org.gnome.system.proxy mode 'none'

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

Via: http://ask.xmodulo.com/change-system-proxy-settings-command-line-ubuntu-desktop.html

Author: Dan Nanni Translator: ictlyh Proofreader: wxy

This article was originally translated by LCTT and launched with the Linux honor in China

This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-06/119164.htm

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.