More actions
To use the FTP command line utility run the command below.
ftp example.com
Connected to example.com. 220 ProFTPD Server (example.com FTP server) Name (example.com): YOUR_USERNAME 331 Password required for YOUR_USERNAME Password: 230 User YOUR_USERNAME logged in Remote system type is UNIX. Using binary mode to transfer files.
- Then enable passive mode:
ftp> passive Passive mode on.
- You can list files with
ls
ordir
:
ftp> ls 227 Entering Passive Mode. 150 Opening BINARY mode data connection for file list app.js bin public_ftp backup public_html www_logs 226 Transfer complete
- Pull a file down from the server with the
get
command:
ftp> get app.js local: app.js remote: app.js 227 Entering Passive Mode (66,39,65,154,129,77). 150 Opening BINARY mode data connection for app.js (338 bytes) 226 Transfer complete 338 bytes received in 0.00 secs (1.2446 MB/s)
- Then disconnect and you can see you have the file on your client machine:
ftp> exit 221 Goodbye. blue@Home:$~> cat app.js const http = require('http'); const hostname = '127.0.0.1'; const port = 3000; ...
- You run commands on your local machine through the ftp shell by prefixing a ! char:
ftp> !cat blah.txt blah blah blah
- To upload a file to a server use the
put
command:
ftp> put blah.txt local: blah.txt remote: blah.txt 227 Entering Passive Mode (66,39,65,154,129,91). 150 Opening BINARY mode data connection for blah.txt 226 Transfer complete 5 bytes sent in 0.00 secs (256.9901 kB/s)
- And then if we check on the remote machine via ftp we can see:
johnlradford@www2:$~> cat blah.txt fart
- To see a help menu for ftp run help:
ftp> help lcd lcd change local working directory