Find Proxy Server using Command Line

Someone's set up a proxy on my machine and I want to know what it is. Is there a way to find the proxy server using the command line and not the GUI?

4

5 Answers

For any system-wide proxy for HTTP, you can check the value of http_proxy environment variable:

echo "$http_proxy"

For HTTPS:

echo "$https_proxy"

Similarly, there are ftp_proxy, socks_proxy for serving the exact purpose of their names. There is also all_proxy for setting proxy for all these protocols at once. Just to note, no_proxy unsets proxy for any specific addresses of any (or all) given protocol. Just for sake of completeness, you might want to check the uppercase version of these variables too, although the lowercases are standard for *_proxy environment variables (only environment variables i am aware of that are lowercased).

Note that, these will show any system-wide proxy setting, not application-specific. For example, firefox, or apt can have their own proxy settings irrespective of any global one. Some applications do not honor these variables too (e.g. specific gnome apps use gsettings), so YMMV.

2

Attempt an http connection to the outside:

wget 

You'll see something like this as a result:

--2017-06-12 13:02:53--
Resolving google.com (google.com)... 172.217.11.142, 2607:f8b0:4002:810::200e
Connecting to google.com (google.com)|172.217.11.142|:80... connected.
HTTP request sent, awaiting response... 302 authenticationrequired
Location: [following]
--2017-06-12 13:02:53--
Connecting to 192.168.254.99:9090... connected.
HTTP request sent, awaiting response... 401 authenticationrequired

Your proxy server in this case is found after the 302 authentication required.

In Linux, you can use this to check the proxies defined in the system

env | grep proxy
1

check the file :

cat /etc/apt/apt.conf
cat /etc/environment

To Modify contents of file (remove everything from apt.conf for no proxy and only proxy sentences from environment)!

sudo nano /etc/apt/apt.conf
sudo nano /etc/environment
10
# netstat -na

OR, if you think/guess any proxy server then grep it to confirm, e.g.

# netstat -na |grep <ProxyGuess IP>
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like