Tag: download

Download a file from a redirecting URL using terminal

Guess this is the first technical stuff that I’m gonna post.

May be this news might be a piece of junk to few tech geeks, but it was new when I came to know yesterday.

TASK: I have been given with a task of installing a bulky software of about 1.3GB in a remote cloud server . The only way I can access that server is via terminal. The setup resource is available in online at a place which has its link redirected to another page but pointing to an FTP file.

Instantly the following ways popped into my mind

  • One can download that bulky setup into my own PC and move it to remote cloud server using ‘scp’ command.
  • Why don’t we try using ‘wget’ command to retrieve files from the Web?

Let me try the second ones first. Obviously, implementing the former one is a bad idea, as it takes ages to download to my PC and do a copy to a remote server. Its something like thalaiya suthi mooka thoduradhu 😛

I tried using wget command followed by the remote file location URL

for eg.,

wget http://www.somesite.com/download/9281380d9494960bff64a64/

The download process has got completed in a fraction of a second, which is not the expected result. Of course this works perfect for ftp sites as this command has come handy many times. I found that it has simply downloaded the HTML file of the server that contains the file, but not the actual file itself.

I was literally longing for a Virtual GUI remote access to do that so, which is absolutely not possible due to access restriction and resource availability!

After a looong find and frustration, this popped into my mind.

Why should I want an entire Virtual GUI remote access for a simple access. All you need is a browser in a terminal, which satisties your need.

Is it possible to get the access of a browser via command?

Ans : Probably, No.

Oh, hey why don’t we search for a command line browser which browses pages via Terminal? If a command prompt can do anything, this should be included in that everything.

Let me search for it.

Wow there is a command line browser available in internet !

Let me try in right away.

Command to install based on the distro you are using

sudo apt-get install lynx

or

yum install lynx

Thus , I started reading its manual pages and started to browse few sites.

Browsing in Lynx consists of highlighting the chosen link using cursor keys, or having all links on a page numbered and entering the chosen link’s number. Despite its text-only nature and age, it can still be used to effectively browse much of the modern web, including performing interactive tasks such as editing Wikipedia.

Thus it has solved my long time task in minutes and it did a decent redirecting and thus downloaded that huge file in minutes directly onto the remote server and proceeded with installing it.

If you found any other ways to download a file (with URL redirection) using terminal, or if I am wrong in any ways, do leave a comment here. Awaiting for suggestions !