Linux wget FAQ: Can you share an example of the Linux wget command?
Suppose you're working on a Unix or Linux machine remotely through an SSH session, and then you need to get a resource (like a tar or gzip file) that's on the Internet over to that machine. You could download that file to your local machine, and then use
scp to copy it to your remote Unix box, but that's a lot of work.
A better way to get that file onto your remote server is to use the Linux wget command from that server, and download that resource directly to your remote server. In this wget tutorial I'll demonstrate how to do this.
A Linux wget download example
I just ran into this situation myself, where I just wanted to get a Ruby resource onto a Linux workstation I was logged into using ssh. (My particular problem is that it takes to ssh logins to get to my remote server.) To make life easier, I just followed these steps to use wget on my remote server to download the resource I needed on that system:
- On my local Windows workstation I searched the internet until I found the need URL I needed, which in this case was "http://tmtm.org/downloads/mysql/ruby/mysql-ruby-2.7.1.tar.gz".
- In my SSH terminal (where I was logged into my remote server) I typed this Linux wget command:
As soon as the wget download was complete, I had the file I needed on my remote server, with no need for the etxra
One thing to know is that this will leave a record in the remote system's access log files, showing the hit coming from the remote system where you ran the
wget command. I don't think that is really a problem, but I thought I should mention it.
I should also note that you can use
w3m on the remote machine as well. I just can't use that as fast as I can use a GUI browser, like Firefox.
Great tip, you've saved my time with this :D Thanks a lot...
thx for the help!!!