如何从终端轻松切换代理方法

如何从终端轻松切换代理方法

如何在代理方法(无、手动、自动)之间切换并从终端将其应用到整个系统?

答案1

一些示例,使用gsettings

# setting a proxy manual
gsettings set org.gnome.system.proxy.socks host '192.168.10.100'
gsettings set org.gnome.system.proxy.socks port 8080
gsettings set org.gnome.system.proxy mode 'manual'

gsettings set org.gnome.system.proxy mode 'none' # this will disable proxy setting

gsettings set org.gnome.system.proxy mode 'auto' # this will set the proxy automatic

答案2

或者你可以使用dconf

dconf write /system/proxy/mode 'none' # this will disable proxy setting
dconf write /system/proxy/mode 'auto' # this will set the proxy automatic
dconf write /system/proxy/mode 'manual' #this will allow you to use the manual settings
dconf write /system/proxy/http/host 'somehost'
dconf write /system/proxy/http/port '1234'

相关内容