How to change system proxy settings from command line on Ubuntu Desktop?

Changing the proxy on Ubuntu server is useful as it helps you to improve system network performance. In addition, it helps you control internet usage, prevent server crashes, and provide better security and faster page load times. Although it is very easy to change the proxy settings for Ubuntu desktop using the GUI method while using the terminal, it can become an awkward situation when a user wants to change the proxy settings close the terminal and switch to the GUI just to change the proxy.

This article will introduce you the command line method to change proxy settings on Ubuntu desktop.

Change Ubuntu desktop proxy settings from command line

To change the system proxy setting in Ubuntu from the command line, we use the gsettings. The gsettings is a command line tool used in Ubuntu to change database settings. gsettings in Ubuntu allow users to monitor or set keys for changes; It is used to manage the settings of the applications

To change the proxy settings on the Ubuntu system, use the command mentioned below to run the gsettings Tool:


Once the gsetting Tool is launched, you can easily change the proxy settings by following the syntax of the commands below:

gsettings Sentence org.gnome.system.proxy. host
gsettings Sentence org.gnome.system.proxy.<proxy name> Harbor <port number>

Now I will use above commands to change proxy settings for each; HTTP, HTTPS, FTP and socks.

For “HTTP” proxy

HTTP proxy is used to identify suspicious web content coming from an untrusted source. It is required in Ubuntu to protect the HTTP server from various attacks. To set up the HTTP proxy settings, run the commands below to specify the host (server name or IP) and port for HTTP:

gsettings Sentence org.gnome.system.proxy.http host ‘’

note: Here I used the IP address as the host, but that’s just one example IP.

The command below sets the port for the http proxy:

gsettings Sentence org.gnome.system.proxy.http port 8000

To check if the HTTP proxy was changed/updated successfully;

echo $http_proxy

For “HTTPS” proxy

Hypertext Transfer Protocol over Secure Socket (HTTPS) is basically a request protocol between server and clients to provide secure transaction and communication for users. To determine the host for https Proxy, run the below mentioned command:

gsettings Sentence org.gnome.system.proxy.https host ‘’

After that, determine the port for HTTPS using the command mentioned below:

gsettings Sentence org.gnome.system.proxy.https port 8000

Then check with below mentioned command:

echo $https_proxy

For “FTP” proxy

The FTP proxy acts as a bridge/relay to transfer files between source and destination. Its performance is better than HTTP for larger files. To change the FTP proxy, run the commands below to discover both the host and the port on the Ubuntu system:

gsettings Sentence org.gnome.system.proxy.ftp host ‘’

gsettings Sentence org.gnome.system.proxy.ftp port 8000

Then check by using the echo command mentioned below

echo $ftp_proxy

For “sock” proxy

The SOCKS proxy facilitates communication between servers through the use of a firewall and supports the routing of any type of traffic generated by any program or protocol. Similar to all of the above that Socks proxy can also be changed with gsetting tool by using the below mentioned commands:

gsettings Sentence org.gnome.system.proxy.socks host ‘’

gsettings Sentence org.gnome.system.proxy.socks port 8000

For example;

echo $all_proxy

How do I change the system-wide proxy settings?

All of the above commands change the proxy setting for the current user, but if you want to imply the same proxy changes system-wide, run all of the commands as well sudo Have administrator rights to change the system proxy:

sudo gsettings

Just to quote that example; here I have only the “http” Proxy setting for the entire system. You can change your desired system-wide proxy settings by following the same commands mentioned in the previous section. However, remember, “sudo” with you:

sudo gsettings Sentence org.gnome.system.proxy.http host ‘’

sudo gsettings Sentence org.gnome.system.proxy.http port 8000

How to switch proxy mode?

There are three proxy setting modes in Ubuntu system and they are:

1: “Auto” mode

Run the commands below to set the proxy mode to “automatic mode”, this is useful if you use PAC (Proxy Auto Config) at Ubuntu.

gsettings Sentence org.gnome.system.proxy autoconfig-url

Switch to automatic mode with the following command:

gsettings Sentence org.gnome.system.proxy mode ‘Automobile’

2: “Manual” mode

Manual mode is used when you want to manually change each proxy setting, as we did in the first two sections of this article.

gsettings Sentence org.gnome.system.proxy mode ‘Manual’

3: None

If you do not want proxy changes to be applied to your system, you can clear all proxy settings using the command mentioned below:

gsettings Sentence org.gnome.system.proxy mode ‘none’


To change the system proxy setting in Ubuntu from the command line, the gsetting tool is used. All proxy settings can be modified/changed with gsetting Tool. The commands and syntax for each proxy setting are explained in the guidelines above. The Proxy Modesautomobile“, “Manual” And “none‘ are also discussed above along with the commands for each mode.

Related Posts