How can I connect to ftp server in terminal? What is the command? For example for the ssh server:

ssh [email protected]

3 Answers 3

ftp hostname



Now, once connected the 5 most common options are:

cd foldername      #e.g. cd /downloads/recent
get filename       #e.g. get thisisthefileiwant.text
put filename       #e.g. put sendthistotheserver.txt
mget filenameregex #e.g mget * to get every file in a directory
mput filemameregex #e.g. mput *.txt to upload every txt file to the server

The only trickery is sometimes you might need to put it into binary mode by typing binary

To exit, type bye

The difference between mine and @grgarside 's solution is his forks it to the Finder using open, while mine uses Terminal

  • Where it downloaded the file when we use get command?
    – Omer
    Oct 3, 2016 at 5:42
  • @Omer It will download to wherever the command.is invoced from, so generally cd to where you want to put it first. There is also a command lcd which may work...lcd changes the local directory path vs cd which changes the remote directory. lcd depending on the ftp version is sometimes flakey, so, the best bet is to cd to where you'd like it first, then use ftp
    – David Fass
    Oct 4, 2016 at 7:59
  • Thanks .... can I put a whole folder from local to remote ?
    – Omer
    Oct 4, 2016 at 8:50
  • @Omer Yes, and no..you'll have to do a mkdir, cd to the directory, then mput * -- ftp is limited in that way. See the related questions using curl (and maybe wget, but, don't quote me on it), if you'd want to do it in one step. Note: mput * will try to move every file in the directory, if you want to be more selective, you can do *.suffix or a file name
    – David Fass
    Oct 10, 2016 at 14:45
  • Also, if you're going to try to transfer lots of files, set the options so you don't need to confirm every transfer
    – David Fass
    Oct 10, 2016 at 14:50

I know that this topic is quiet old but I found it accidentally and maybe someone other will visit this site too. ftp command no longer works for High Sierra and higher. https://discussions.apple.com/thread/8095899

open ftp://username:password@hostname

These are two separate commands. The open command is run within ftp.

  • 2
    User = name of one user of cp, password = passwd of this user, and hostname = ip address of computer where I would like to connect? Dec 14, 2014 at 17:22
  • @blackcornail Yes, this is true
    – grg
    Dec 14, 2014 at 18:16
  • 1
    how to escape special chars? for example, username containing @
    – JCarlosR
    Jan 14, 2022 at 19:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .