• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to use wget to download file via proxy

By admin

The wget program allows you to download files from URLs. Although it can do a lot, the simplest form of the command is: wget [some URL]. Assuming no errors, it will place that file in the current directory. If you do not specify a filename, by default it will attempt to get the index.html file.

This document descript how to set wget (The non-interactive network downloader) to download file via proxy.

wget Configuration files

Below are wget configuration files listed by their priorities:

  • ~/.wgetrc: User startup file.
  • /etc/wgetrc: Default location of the global startup file.
  • Set proxy variables in shell for current pseudo-terminal.
  • ~/.bash_profile: User specific environment.
  • /etc/profile: System wide environment.
Note: If higher priority configuration is not set, then the very next priority configuration takes effective. For instance, ~/.wgetrc was not configured with proxy settings but /etc/wgetrc was configured, then proxy settings in /etc/wgetrc are the working proxys in wget.

Configuring wget proxy

1. Add below line(s) in file ~/.wgetrc or /etc/wgetrc:

http_proxy = http://[Proxy_Server]:[port]
https_proxy = http://[Proxy_Server]:[port]
ftp_proxy = http://[Proxy_Server]:[port]

2. Set proxy variable(s) in a shell manually:

$ export http_proxy=http://[Proxy_Server]:[port]
$ export https_proxy=$http_proxy
$ export ftp_proxy=$http_proxy

Verify the variable values using the “env” command.

$ env | grep proxy
http_proxy=http://[Proxy_Server]:[port]
https_proxy=http://[Proxy_Server]:[port]
ftp_proxy=http://[Proxy_Server]:[port]

3. Add below line(s) in file ~/.bash_profile or /etc/profile:

# export http_proxy=http://[Proxy_Server]:[port]
# export https_proxy=http://[Proxy_Server]:[port]
# export ftp_proxy=http://[Proxy_Server]:[port]
How to Configure Proxy Server in CentOS/RHEL/Fedora

Filed Under: Linux

Some more articles you might also be interested in …

  1. Understanding Variables in Bash Shell Under Linux
  2. How to install and configure Samba in CentOS / RHEL
  3. How To Disable Ksplice Service on OEL
  4. CentOS / RHEL 6 : How to Disable / Enable direct root login via telnet
  5. How to Disable “Predictable Network Interface Device Names” in CentOS/RHEL 7
  6. Configuring Remote Logging using rsyslog in CentOS/RHEL
  7. Managing a GFS2 File System – Adding journals, extending and repairing GFS2
  8. 10 useful cron examples to schedule jobs in Linux
  9. Status Commands in Linux – date, ps, who, uptime, finger, rup, ruser
  10. How to gzip all or specific files in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • How to Disable IPv6 on Ubuntu 18.04 Bionic Beaver Linux
  • How to Capture More Logs in /var/log/dmesg for CentOS/RHEL
  • Unable to Start RDMA Services on CentOS/RHEL 7
  • How to rename a KVM VM with virsh
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary