ftp: Name or Service not known
Asked Answered
P

3

23

in command line

> ftp ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/data/

Work on one computer but does not work on my other one. Error returned

ftp: ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/data/: Name or service not known

I also tried the raw IP address which is

> ftp ftp://130.14.250.10/1000genomes/ftp/data/

But it didn't work.

What is the problem here? how can I fix this?

Putandtake answered 6/8, 2013 at 20:38 Comment(0)
V
27

The ftp command accepts the server name, not a URL. Your session likely should look like:

ftp ftp-trace.ncbi.nih.gov
(Server asks for login and password)
cd /1000genomes/ftp/data/
mget *
Vocational answered 6/8, 2013 at 20:39 Comment(4)
Hmm. It works perfectly fine on my MacOS. but even if delete the trailing path. the results is still the samePutandtake
Are you on Linux or on OS X? The question is tagged with Linux.Vocational
Thanks for the elaboration. Works like magic. so it must be becasuse the 2 computers using different ftp program and one is able to recognize directory path. You are right, the one that is working fine is on MacOSPutandtake
Yes, the version of "ftp" included in most Linux distros is more primitive; people tend to prefer wget or curl.Vocational
S
5

This depends on the ftp client you are using. On Mac OSX (ftp client from BSD), for example, the default command line ftp client accepts the full url, while for example in CentOS the default client doesn't, and you need to connect just to the hostname. So, it depends on the flavor of linux and the installed default ftp client.

Default ftp client in CentOS (ARPANET):

ftp ftp-trace.ncbi.nih.gov
cd 1000genomes/ftp/data

If you want to use the full url in CentOS 5.9 or Fedora 18 (where I tested it), you could install an additional ftp client. For example ncftp and lftp have the behavior you are looking for.

ncftp, available through yum or your favorite package manager:

 ncftp ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/data/
 NcFTP 3.2.2 (Aug 18, 2008) by Mike Gleason (http://www.NcFTP.com/contact/).
 Connecting to ...
 ...
 Logged in to ftp-trace.ncbi.nih.gov.
 Current remote directory is /1000genomes/ftp/data

lftp, also available through your favorite package manager:

 lftp ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/data/
 cd ok, cwd=/1000genomes/ftp/data                                         
 lftp ftp-trace.ncbi.nih.gov:/1000genomes/ftp/data> 

Another, more efficient, way to retrieve a page, is using wget or curl. These work for http, ftp and other protocols.

Skutchan answered 6/8, 2013 at 20:47 Comment(0)
T
0

It looks to me like the computer that isn't working is already adding the ftp: to the URL, have you tried removing it from yours and seeing if that works?

> ftp ftp-trace.ncbi.nih.gov/1000genomes/ftp/data
Teodora answered 6/8, 2013 at 20:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.