Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»General Articles»How to Use Curl Command with Proxy on Linux

    How to Use Curl Command with Proxy on Linux

    RahulBy RahulSeptember 11, 20191 Min ReadUpdated:October 10, 2019

    Curl is a utility used for data transfer in command lines or scripts. In this tutorial, you will learn how to use the curl command to connect via a proxy server on the Linux system.

    Using Environment Variable

    In a very simple word, you can simply set the following environment variables on your system. The curl command will automatically use these variables as a proxy. You can export those variables in your shell, like:

    Without Authentication 
    
    export http_proxy="http://proxy.server:port"
    export https_proxy="https://proxy.server:port"
    
    With Authentication 
    
    export http_proxy="http://username:[email protected]:port"
    export https_proxy="https://username:[email protected]:port"
    

    After exporting the environment variables, the curl command will automatically use the above proxy during a remote connection.

    curl http://example.com
    

    Once your work is done, you can simply unset these environment variables like:

    unset http_proxy
    unset https_proxy
    

    Without Environment Variable

    Instead of setting environment variables, you can simply pass the proxy details to curl command as a command-line parameter.

    curl -x "http://username:[email protected]:port" http://example.com
    
    curl proxy
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Install GIMP on MacOS
    Next Article Download CentOS 8 – DVD ISO Image

    Related Posts

    How to Install Sublime Text 4 on Ubuntu 22.04

    2 Mins Read

    How to Find Django Install Location in Linux

    Updated:April 27, 20221 Min Read

    (Resolved) – ReactJS 404 Error on Page Reload

    2 Mins Read

    Adding a New SSH Key in GitHub

    Updated:April 1, 20223 Mins Read

    13 Best Linux Terminal Emulators and Bash Editors

    8 Mins Read

    How To Install Oracle VirtualBox on Debian 11

    2 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Install Sublime Text 4 on Ubuntu 22.04
    • How to Enable / disable Firewall in Windows
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.