Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Using the FTP CLI Utility

From John's Wiki
Revision as of 12:34, 4 October 2023 by Admin (talk | contribs) (Created page with "To use the FTP command line utility run the command below. ftp example.com <pre> 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. </pre> * Then enable passive mode: <pre> ftp> passive Passive mode on. </pre> * You can list files with <code>ls</code...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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 or dir:
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