Test Proxy Connection Linux

Test Proxy Connection Linux

test a remote proxy from the command line – LinuxQuestions.org

HTTP Rotating & Static

  • 200 thousand IPs
  • Locations: US, EU
  • Monthly price: from $39
  • 1 day moneyback guarantee

Visit stormproxies.com

Linux – Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Welcome to, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register NowIf you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
06-06-2008, 11:59 AM
Senior Member
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1, 623
test a remote proxy from the command line
howto test a remote proxy from the command line?
proxy port should be open:
# telnet 192. 168. 0. 1 3128
Trying 192. 1…
Connected to 192. 1.
Escape character is ‘^]’.
but what are next steps to test HTTP?
I have debian Etch stable on the local machine and on the proxy server.
06-06-2008, 01:05 PM
Registered: May 2001
Location: India, Kerala, Thrissur
Distribution: FC 7-10
Posts: 354
Blog Entries: 2
hmm… why can’t you just configure this proxy in your browser and test?

Sorry, I missed the command line part.
export _proxy=no use wget to get a page

Last edited by sarin; 06-06-2008 at 01:12 PM.
Reason: did not see the full question
09-22-2014, 05:44 AM
LQ Newbie
Registered: Jul 2013
Posts: 19
Use the following syntax to configure the proxy for, and ftp traffic on the Linux command line:
$ export _proxy=”proxy-server:port”
$ export ftp_proxy=”proxy-server:port”
Use the following syntax if the proxy server requires authentication:
$ export _proxy=”user:[email protected]:port”
$ export ftp_proxy=”user:[email protected]:port”
Testing Proxy
Use the following command to check current proxy settings:You can test the proxy by checking your public IP address from the command line:
$ wget -q -O – \ | sed -e ‘s/. *Current IP Address: //’ -e ‘s/<. *$//' You may also use the time command to test the differences in the connection speed with proxy and without it: $ time wget -q -O - \ | sed -e 's/. *$//' REFERENCE: All times are GMT -5. The time now is 02:46 PM. Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know. Main Menu LQ Calendar LQ Rules LQ Sitemap Site FAQ View New Posts View Latest Posts Zero Reply Threads LQ Wiki Most Wanted Jeremy's Blog Report LQ Bug How to test if proxy is working correctly? - Super User


  • No logs
  • Kill Switch
  • 6 devices
  • Monthly price: $4.92

Visit nordvpn.com

How to test if proxy is working correctly? – Super User

I am trying to test if proxy is working correctly using this script. Problem is that it no matter what ends by echo “Proxy is working”. Any ideas please?
export _proxy=”
wget -nv –proxy-user=test –proxy-password=test > ${OUTPUT_FILE} 2>&1
grep -q ‘

You cant use internet

if [ “$? ” -eq ‘0’] then
echo “Proxy isnt working. ” | mail -s “Proxy isnt working” -r “No-reply<>”
echo “Proxy is working”
rm -f /tmp/$$
asked Feb 10 ’17 at 9:42
Although somewhat old question, but it may be still have some value to provide another answer. So here is mine:
set_proxies() {
export _proxy= export HTTP_PROXY=${_proxy}
export _proxy= export HTTPS_PROXY=${_proxy}
export ftp_proxy= export FTP_PROXY=${ftp_proxy}
export socks_proxy=socks
export SOCKS_PROXY=${socks_proxy}
export no_proxy=localhost, 127. 0. 1,, 192. 168. 9. 100
export NO_PROXY=${no_proxy}
export all_proxy=socks5}
curl -s -m 2 $URL > /dev/null
if [ $? == 0] then
STATUS=”No Corporate Proxy”
STATUS=”Behind Corporate proxy”
echo $STATUS
answered Apr 6 ’18 at 17:21
I have solved it this way:
wget -q –proxy-user=test –proxy-password=test –spider $URL
if [ $? = 1] STATUS= echo “Proxy isn’t working”
STATUS=”Proxy is working. ”
answered Feb 17 ’17 at 7:00
The problem is because of the quotes around $? in the if check:
When the grep didn’t find the string you were looking for, the return code was 1. So this if check equates to:
if [ “1” -eq ‘0’] which is always false, hence you get “Proxy is working”.
if [ $? -eq 0] instead.
answered Feb 10 ’17 at 18:59
Not the answer you’re looking for? Browse other questions tagged linux bash proxy script or ask your own question.
Trying to test if proxy is working - Unix & Linux Stack Exchange

Trying to test if proxy is working – Unix & Linux Stack Exchange

I wrote this simple script:
export _proxy=”
wget -nvq –proxy-user=test –proxy-password=test &>/dev/null | grep -q ‘You cant user internet’ || echo “Proxy isnt working. ” | mail -s “Proxy isnt working” -r “No-reply<>”
Steps taken:
Export the address of our proxy.
Download from with wget.
Check result from proxy for ‘You cant user internet’
If found, then it should end but where not found it should send email to my address.
Problem is that it sends email even if it finds ‘You cant user internet’.
Rui F Ribeiro51. 5k22 gold badges130 silver badges204 bronze badges
asked Feb 10 ’17 at 7:09
use () in your echo block
wget -nvq –proxy-user=test –proxy-password=test &>/dev/null | grep -q ‘You cant user internet’ || (echo “Proxy isnt working. ” | mail -s “Proxy isnt working” -r “No-reply<>“)
try this script.. in your onliner, you are running the wget in background and trying to grep the contents…
#! /bin/bash
wget -nvq –proxy-user=test –proxy-password=test > ${OUTPUT_FILE} 2>&1
grep -q ‘You cant user internet’ ${OUTPUT_FILE}
if [ “$? ” -eq “0”] then
echo “Proxy isnt working. ” | mail -s “Proxy isnt working” -r “No-reply<>”
echo “Proxy is working”
answered Feb 10 ’17 at 7:11
KamarajKamaraj3, 9571 gold badge10 silver badges17 bronze badges
Not the answer you’re looking for? Browse other questions tagged shell-script proxy or ask your own question.

Frequently Asked Questions about test proxy connection linux

How do I test my proxy connection?

Click the “Connections” tab in the Internet Options window. Click the “LAN Settings” button. If there is a check mark in the box next to the “Us a proxy server for your LAN” option, then your PC accesses the Web through a proxy server. If there is no check mark in the box, your computer does not use a proxy server.

How do I know if my proxy is working Linux?

Method 1: Start a new shell (xterm), then check the environment variables: % env | grep -i proxy http_proxy= ftp_proxy= all_proxy=socks:// … Note that existing shells will not have updated environment variables.Sep 7, 2010

How do I know if my proxy port is working?

Assuming you are using almost any version of Windows, you can just open up Internet Explorer and then open the Internet Options. Flip over to the Connections tab, and then click the LAN settings button at the bottom. This dialog should instantly tell you whether you are using a proxy or not.Jan 12, 2015

Share this post

Leave a Reply

Your email address will not be published.