Your provided URL downloads fine using for example:
wget "URL"
curl -O "URL"
As mentioned in comments: quote. Always quote!
Letters like &
has a special meaning in shells and the URL is not going to be interpreted as you want without them.
As for downloading without knowing the file name – I'm still not quite sure what you mean, but some notes:
This is site specific for ebi.ac.uk
The URL provided is a special form of URI. You are most likely interested in the query part, and more specifically the first section: U00096.3
.
You can change this to represent other files and ranges. for example to download U00000
to U00096
say:
curl -O "http://www.ebi.ac.uk/ena/data/view/U00000-U00096&display=fasta&download=fasta&filename=U00000-U00096.fasta"
^^^^ data ^^^
The file name part is simply a suggestion on what to name the file. You can change this to anything you want. For example: filename=myown.fasta
– is not going to change what is downloaded only what name is proposed by the server -> web-browser, and can also be used by curl etc.
There are a lot of search and listing possibilities on the site and you have to poke around.
More on what is happening
As you click the download link, or use tools like curl or wget a request is sent to the server at ebi.ac.uk for a specific file. In your example it likely has a referer set to:
http://www.ebi.ac.uk/ena/data/view/U00096.3
and a GET query reported as:
query['display'] = fasta
query['download'] = fasta
query['filename'] = entry.fasta
The sever responds with something, among others, like:
Content-Disposition: attachment; filename=entry.fasta
This is a way for the server to rely a suggestion for file name back to the client. If you use a curl version that has the -J
option you can use this to save the file by this name: I.e.:
curl -OJ "URL"
As mentioned
This is quite site specific and the way the URL is interpreted on the server has to do with how the site is set up.
On a different host using another setup with a query part as filename=foo.txt
could just as well be that you are served the an actual file named foo.txt
from the server.
As for this site, ebi.ac.uk, the file is not a file but dynamically generated content using queries to databases. The result of the query is merged into a file and served to the end user.
wget "URL"
andcurl -O "URL"
. Complete genome saved to disk. There is no redirect involved. (Did you remember to quote the URL?) – Runium Nov 07 '15 at 21:44(I meant without a specific URL to entry.fasta.)
– IGS Nov 07 '15 at 21:50