Configure Proxy for Chromium and Google Chrome From Command Line
In this tutorial, I will show you how to configure proxy settings of Chromium and Google Chrome browser from the command line. This little trick comes very handy in some circumstances.
As you may already know, the Linux version of Chromium and Google Chrome browser does not support configuring proxy in a graphical way. A Windows user can change proxy settings in Chromium and Google Chrome by going to Settings > Network and click the Change proxy settings button to configure it. But on Linux, this button is grayed out and users can not change proxy in this way.
Normally, users need to install extensions like Proxy SwitchyOmega in order to configure it in graphical interface. That’s Okay for most people, but it’s not convenient for those who can’t access the Chrome Web store. Google search and chrome Web store are blocked in some countries and areas.
If you use Chromium or Google Chrome browser on Linux, then you can configure proxy for your browser from the command line and you don’t have to install extensions like Proxy SwitchyOmega to setup proxy in Chromium and Google Chrome browser.
Configure Proxy From Command Line
I use Chromium as an example and it applies to Google Chrome as well. You can start chromium from the command line with this command:
To start it with proxy, use –proxy-server option. For example, start it with socks5 proxy.
Chromium and Google Chrome support HTTP, HTTPS, socks4 and socks5 proxy. To set a HTTPS proxy:
You can also set an alias. Edit .bashrc file
Find the alias lines in this file and add the following alias definition to it.
alias chromium='chromium --proxy-server="proxy-scheme://proxy-ip:proxy-port"'
Save this file. Because commands in .bashrc file is exeucted when user logs in, so now log out and log back in. Then enter chromium in the terminal, you will see chromium browser is no using a proxy to connect to the Internet.
Note: On Some Linux distributions such as Ubuntu, The command to start Chromium browser is
Install Proxy SwitchyOmega extension
Some users can use VPN to access Chrome store and install Proxy SwithcyOmege extension, but in some area, VPN is blocked. So being able to configure proxy from the command line is very handy for those who can’t access chrome web store.
Once the proxy is working, you can go to chrome Web store and install Proxy SwitchyOmega. Or you can just use command to configure proxy.
I like Proxy SwitchyOmega because it has the ability to detect failed resources on web pages and this can really help web developers or webmasters.
Chromium and Google Chrome Browser also support proxy autoconfiguration URL. Use –proxy-pac-url option. For more command line usage , see the man page.
man chromium man google-chrome
To see how to setup your own shadowsocks proxy server, check out the following post.