LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-28-2006, 11:05 AM   #1
gletare
LQ Newbie
 
Registered: Oct 2005
Location: Belgium
Distribution: Fedora Core 4
Posts: 14

Rep: Reputation: 0
Getting a remote file 'http://...' with a bash command


Hi,

I would like to copy on my disk a remote file ('http://theLocation/theFile.txt') thanks to a bash command. How can I do that ?

Thanks in advance
 
Old 11-28-2006, 11:09 AM   #2
chort
Senior Member
 
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660

Rep: Reputation: 75
Assuming wget is installed:

Code:
wget http://theLocation/theFile.txt
 
Old 11-28-2006, 11:20 AM   #3
gletare
LQ Newbie
 
Registered: Oct 2005
Location: Belgium
Distribution: Fedora Core 4
Posts: 14

Original Poster
Rep: Reputation: 0
Thanks a lot.
 
Old 11-28-2006, 11:25 AM   #4
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
You could also use curl or GET.
 
Old 11-28-2006, 12:01 PM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594
...other alternatives: lynx, links, elinks, bget.
In pure Bash (credit techguy for example):
Code:
exec 5<>/dev/tcp/the.locati.on/80
echo -en "GET /thefile.txt HTTP/1.0\n\n" >&5
cat <&5 > $PWD/thefile.txt
 
Old 11-28-2006, 12:23 PM   #6
dasy2k1
Member
 
Registered: Oct 2005
Location: 127.0.0.1
Distribution: Ubuntu 12.04 X86_64
Posts: 960

Rep: Reputation: 35
wget is just the most simple usefull little thing and easist for newbies.

just make sure you are in the directory where you want to save teh file then

wget http://server.???/file
 
Old 11-28-2006, 12:41 PM   #7
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
Quote:
Originally Posted by unSpawn
...other alternatives: lynx, links, elinks, bget.
In pure Bash (credit techguy for example):
Code:
exec 5<>/dev/tcp/the.locati.on/80
echo -en "GET /thefile.txt HTTP/1.0\n\n" >&5
cat <&5 > $PWD/thefile.txt
That's a new one on me... nice!
 
Old 11-29-2006, 03:28 AM   #8
dasy2k1
Member
 
Registered: Oct 2005
Location: 127.0.0.1
Distribution: Ubuntu 12.04 X86_64
Posts: 960

Rep: Reputation: 35
Quote:
Originally Posted by unSpawn
...other alternatives: lynx, links, elinks, bget.
In pure Bash (credit techguy for example):
Code:
exec 5<>/dev/tcp/the.locati.on/80
echo -en "GET /thefile.txt HTTP/1.0\n\n" >&5
cat <&5 > $PWD/thefile.txt
isnt that just manually conecting via TCP to the server,
issuing the web GET command storing the data to a variable then transfering it to a file....

ok if you like emssing with the gory details of the Http protocall
 
Old 11-29-2006, 10:55 AM   #9
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594
That's a new one on me... nice!
Cool, innit? Picked up the code trying to find us a portable downloader for RKH.


//subliminal message: nice project, lotsa exposure, lotsa users, Bourne/C/C++ devs needed, come on and join...
 
Old 11-29-2006, 11:03 AM   #10
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594
storing the data to a variable
fd, not variable.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Remote access through HTTP Proxy technopasta Linux - Networking 4 05-18-2006 04:52 PM
remote access via http? taiwf Linux - General 2 05-16-2006 12:11 AM
best version for home file server with remote access via http??? soundengineer Linux From Scratch 1 06-05-2004 06:32 AM
Able to mount remote drive via http keithturner Solaris / OpenSolaris 1 01-24-2003 03:45 PM
linux command error message bash: /usr/bin/find: No such file or directory sundaram123 Linux - General 8 04-02-2002 07:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration