FTP/SFTP Command Line Connections
Open a connection with FTP
Or with SFTP, most of the operations below match, minus the passive modes since it uses SSH.
$ sftp -P [port] [user]@[sftp-host]
For FTP (not SFTP) enter passive mode so that it won't try and use the same port for access and for commands
- FTP is old and it required two points, one to connect with the accessor and one to send data
- Generally this is not setup so the passive mode makes the connection with each request
Connect to an FTP server
ftp> open www.acme.com Connected to acme.com. 220 (vsFTPd 3.0.3) Name (www.acme.com:ubuntu): UserNameHere 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files.
Find out what commands are available
ftp> help Commands may be abbreviated. Commands are: ! dir mdelete qc site $ disconnect mdir sendport size account exit mget put status append form mkdir pwd struct ascii get mls quit system bell glob mode quote sunique binary hash modtime recv tenex bye help mput reget tick case idle newer rstatus trace cd image nmap rhelp type cdup ipany nlist rename user chmod ipv4 ntrans reset umask close ipv6 open restart verbose cr lcd prompt rmdir ? delete ls passive runique debug macdef proxy send
ftp> ls 227 Entering Passive Mode (52,22,81,201,47,31). 150 Here comes the directory listing. drwxrwx--x 2 ftp ftp 4096 Jul 02 15:59 STS use only - completed drwxrwx--x 2 ftp ftp 4096 Jul 08 16:30 download drwxrwx--x 2 ftp ftp 4096 Jul 08 16:36 upload 226 Directory send OK. ftp> exit 221 Goodbye.