Page 1 of 1

Download a File with cURL or Wget

Posted: Mon May 24, 2021 11:35 am America/New_York
by njester
The following allows you to download data from using linux, a mac, or Windows with Cygin.

1) If you haven't before, create an authentication cookie that can be used with to access files behind the EarthData login page.

Code: Select all

USERNAME=<your earthdata username>
PASSWORD=<your earthdata password>
cd ~ 
touch .netrc 
echo "machine login $USERNAME password $PASSWORD" > .netrc 
chmod 0600 .netrc 
touch .urs_cookies 
2) You can download data with the following commands:

Code: Select all

URL=<your url here>
curl -b ~/.urs_cookies -c ~/.urs_cookies --remote-name --location  --netrc $URL

Code: Select all

wget --load-cookies ~/.urs_cookies --save-cookies ~/.urs_cookies --auth-no-challenge=on --keep-session-cookies --content-disposition $URL
You can learn more about these command line tools here: ... L+And+Wget