|

Linux CLI 32 🐧 ftp and wget commands

ftp 51.174.98.195

ftp and wget both deal with transferring files over a network, but they serve very different purposes. ftp opens an interactive session where you can browse and manage files on a remote server. wget is a non-interactive downloader built for scripts and automation.

Key point: FTP sends credentials and data in plain text — it’s insecure. For anything sensitive, use SFTP (over SSH) or FTPS instead. wget supports HTTPS, which is encrypted.


a – ftp command

ftp connects to a remote server using the FTP protocol. After the connection, the FTP interface is initiated. That interface has commands you can use to manage or transfer files to and from the remote system.

ftp 52.175.95.215

If the server does not allow anonymous login, it will ask for a name and password. Once connected, you get a prompt like ftp> where you can type commands.

CommandDescription
ftp 52.175.95.215Connects to a remote server
helpDisplays all supported commands
exitLogs off the remote server
cdChange directory on the remote server
cdupGo up one directory on the remote server
deleteDelete a file on the remote server
idleSet idle timeout
imageSet binary transfer mode
lcdChange directory on the local machine
mdirList multiple remote directories
mgetDownload multiple files
putUpload a file

Example session:

$ ftp 52.175.95.215
Connected to 52.175.95.215.
220 (vsFTPd 3.0.3)
Name (52.175.95.215:kronos): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.

ftp> help
Commands may be abbreviated.  Commands are:

!       debug   mget    put     site    ...
?       dir     mkdir   pwd     size    ...
append  disconnect  mls  quit    status  ...
ascii   form    mode    quote   struct  ...
bell    get     modtime  recv   system  ...
binary  glob    mput    reget   tenex   ...
bye     hash    newer   rstatus  trace   ...
case    help    nmap    rhelp   type    ...
cd      idle    nlist   rename  user    ...
cdup    image   ntrans  reset   umask   ...
chmod   lcd     open    restart  verbose ...
close   ls      passive  rmdir   xferbuf ...
cr      macdef  prompt  runique ...
delete  mdelete  proxy  send    ...

ftp> ls
229 Entering Extended Passive Mode
150 Here comes the directory listing.
drwxr-xr-x    2 0        0            4096 Jan 15 10:00 pub
-rw-r--r--    1 0        0         1048576 Jan 15 10:05 readme.txt
226 Directory send OK.

ftp> cd pub
250 Directory successfully changed.

ftp> pwd
257 "/pub"

ftp> get readme.txt
local: readme.txt remote: readme.txt
229 Entering Extended Passive Mode
150 Opening BINARY mode data connection for readme.txt (1048576 bytes).
100% |***********************************| 1024k  1.2 MB/s    00:00 ETA
226 Transfer complete.
1048576 bytes received in 00:00 (1.2 MB/s)

ftp> put localfile.txt
local: localfile.txt remote: localfile.txt
229 Entering Extended Passive Mode
150 Ok to send data.
100% |***********************************|  512k  800 kB/s    00:00 ETA
226 Transfer complete.
524288 bytes sent in 00:00 (800 kB/s)

ftp> bye
221 Goodbye.

Tip: Type help at the ftp> prompt to see the full list. Type help COMMAND for details on a specific command.


b – ftp examples

Once connected, you use FTP commands to move files around. Here are the most useful ones:

CommandDescription
get filename /local/path/to/save/fileDownloads a file
put /local/path/to/save/file filenameUploads a file
delete filenameDeletes a file
mdelete file1 file2 file3Deletes multiple files
mkdir directoryNameCreates a directory
mget file1 file2 file3Downloads multiple files
mput file1 file2 file3Uploads multiple files
rename old newRenames a file

Examples:

# Download a single file
ftp> get readme.txt
local: readme.txt remote: readme.txt
...

# Download and save to a specific local path
ftp> get readme.txt /home/kronos/downloads/readme.txt
local: /home/kronos/downloads/readme.txt remote: readme.txt
...

# Upload a file
ftp> put /home/kronos/report.pdf report.pdf
local: /home/kronos/report.pdf remote: report.pdf
...

# Download multiple files
ftp> mget file1.txt file2.txt file3.txt
mget file1.txt? y
...
mget file2.txt? y
...
mget file3.txt? y
...

# Upload multiple files
ftp> mput report1.pdf report2.pdf
mput report1.pdf? y
...
mput report2.pdf? y
...

# Delete a single file
ftp> delete oldfile.txt

# Delete multiple files
ftp> mdelete old1.txt old2.txt old3.txt

# Create a directory
ftp> mkdir newfolder

# Rename a file
ftp> rename oldname.txt newname.txt

Note: Many FTP clients prompt mget file1.txt? y for each file in a multi-file operation. You can disable that with prompt (toggles prompting on/off).


c – wget command

wget is used to download files from a server. It supports FTP, HTTP, and HTTPS protocols, and unlike ftp, it’s non-interactive — you give it a URL and it downloads.

CommandDescription
wget 'http://example.com/file'Downloads a file
wget -O localfile1.txt 'http://example.com/file'Downloads and renames the file
wget -c 'http://example.com/file'Resumes a download if it failed
wget --http-user=username --http-password=password http://example.com/file.txtProvides authentication credentials

Common options:

OptionDescription
-bDownloads in the background
-rRecursive download
-i filenameReads URLs from a file
-w 5Waits 5 seconds between downloads

Examples:

# Basic download
$ wget 'http://example.com/file.zip'
--2024-01-15 10:30:00--  http://example.com/file.zip
Resolving example.com... 93.184.216.34
Connecting to example.com|93.184.216.34|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10485760 (10M) [application/zip]
Saving to: 'file.zip'

file.zip      100%[==================>]  10.00M  5.2MB/s    in 1.9s

2024-01-15 10:30:02 (5.2 MB/s) - 'file.zip' saved [10485760/10485760]

# Rename the output file
$ wget -O myfile.zip 'http://example.com/file.zip'
...
Saving to: 'myfile.zip'
...

# Resume a failed download
$ wget -c 'http://example.com/largefile.iso'
...
Saving to: 'largefile.iso'

largefile.iso  45%[=======>           ]  2.25G  4.5MB/s    eta 5m 12s

# Download with authentication
$ wget --http-user=kronos --http-password=secret123 http://example.com/protected.txt
...

# Download in the background
$ wget -b 'http://example.com/bigfile.iso'
Continuing in background, pid 12345.
Output will be written to 'wget-log'.

# Read URLs from a file and download all
$ cat urls.txt
http://example.com/file1.txt
http://example.com/file2.txt
http://example.com/file3.txt

$ wget -i urls.txt
...

# Wait 5 seconds between downloads
$ wget -w 5 -i urls.txt
...

# Recursive download (whole site — be careful!)
$ wget -r 'http://example.com/docs/'
...

# Download via HTTPS
$ wget 'https://example.com/file.zip'
...

# Download via FTP
$ wget 'ftp://ftp.example.com/pub/file.tar.gz'
...

# Limit download speed
$ wget --limit-rate=500k 'http://example.com/bigfile.iso'
...

# Quiet mode (no output except errors)
$ wget -q 'http://example.com/file.zip'

Warning: -r (recursive) can download an entire website and quickly fill your disk or hammer a server. Use it carefully, and consider --wait and --limit-rate to be polite.


Complete Example Session

# ============================================
# PART 1: CONNECT WITH FTP
# ============================================

$ ftp 52.175.95.215
Connected to 52.175.95.215.
220 (vsFTPd 3.0.3)
Name (52.175.95.215:kronos): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.

ftp> help
Commands may be abbreviated.  Commands are:
!       debug   mget    put     site    ...
?       dir     mkdir   pwd     size    ...
...

# ============================================
# PART 2: NAVIGATE REMOTE FILES
# ============================================

ftp> ls
229 Entering Extended Passive Mode
150 Here comes the directory listing.
drwxr-xr-x    2 0        0            4096 Jan 15 10:00 pub
-rw-r--r--    1 0        0         1048576 Jan 15 10:05 readme.txt
226 Directory send OK.

ftp> cd pub
250 Directory successfully changed.

ftp> pwd
257 "/pub"

ftp> cdup
250 Directory successfully changed.

ftp> pwd
257 "/"

# ============================================
# PART 3: TRANSFER FILES
# ============================================

# Download a file
ftp> get readme.txt
local: readme.txt remote: readme.txt
...
1048576 bytes received in 00:00 (1.2 MB/s)

# Download multiple files
ftp> mget file1.txt file2.txt
mget file1.txt? y
...
mget file2.txt? y
...

# Upload a file
ftp> put /home/kronos/report.pdf report.pdf
local: /home/kronos/report.pdf remote: report.pdf
...
524288 bytes sent in 00:00 (800 kB/s)

# Upload multiple files
ftp> mput report1.pdf report2.pdf
mput report1.pdf? y
...
mput report2.pdf? y
...

# ============================================
# PART 4: MANAGE REMOTE FILES
# ============================================

ftp> mkdir newfolder
257 "/newfolder" created

ftp> rename oldname.txt newname.txt
350 Ready for RNTO.
250 Rename successful.

ftp> delete oldfile.txt
250 Delete operation successful.

ftp> mdelete old1.txt old2.txt
mdelete old1.txt? y
mdelete old2.txt? y

# ============================================
# PART 5: EXIT
# ============================================

ftp> bye
221 Goodbye.

# ============================================
# PART 6: DOWNLOAD WITH WGET
# ============================================

$ wget 'https://example.com/file.zip'
--2024-01-15 10:30:00--  https://example.com/file.zip
Resolving example.com... 93.184.216.34
Connecting to example.com|93.184.216.34|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10485760 (10M) [application/zip]
Saving to: 'file.zip'

file.zip      100%[==================>]  10.00M  5.2MB/s    in 1.9s

2024-01-15 10:30:02 (5.2 MB/s) - 'file.zip' saved [10485760/10485760]

# ============================================
# PART 7: WGET OPTIONS
# ============================================

# Rename output
$ wget -O myfile.zip 'https://example.com/file.zip'

# Resume
$ wget -c 'https://example.com/largefile.iso'

# Auth
$ wget --http-user=kronos --http-password=secret123 https://example.com/protected.txt

# Background
$ wget -b 'https://example.com/bigfile.iso'

# Batch from file
$ wget -i urls.txt

# Polite crawl
$ wget -r -w 2 --limit-rate=500k 'https://example.com/docs/'

# ============================================
# PART 8: VERIFY DOWNLOADS
# ============================================

$ ls -lh file.zip myfile.zip
-rw-r--r-- 1 kronos kronos 10M Jan 15 10:30 file.zip
-rw-r--r-- 1 kronos kronos 10M Jan 15 10:31 myfile.zip

$ sha256sum file.zip
abc123def456...  file.zip

Quick Reference

FTP

CommandPurpose
ftp HOSTConnect to a server
helpList commands
lsList remote files
cd DIRChange remote directory
cdupUp one remote directory
lcd DIRChange local directory
pwdShow remote directory
get FILEDownload a file
mget F1 F2Download multiple
put FILEUpload a file
mput F1 F2Upload multiple
delete FILEDelete a file
mdelete F1 F2Delete multiple
mkdir DIRCreate remote directory
rename OLD NEWRename remote file
binarySet binary mode
bye / exitDisconnect

wget

OptionPurpose
wget URLDownload a file
wget -O FILE URLSave with a new name
wget -c URLResume a download
wget -b URLBackground download
wget -i FILERead URLs from file
wget -r URLRecursive download
wget -w N URLWait N seconds
wget -q URLQuiet mode
wget --limit-rate=N URLLimit speed
wget --http-user=U --http-password=P URLHTTP auth

Best Practices

Do This:

# Use SFTP or FTPS for sensitive transfers
sftp user@host                         # ✅ encrypted

# Use wget -c for large downloads
wget -c 'https://example.com/big.iso'  # ✅ resumable

# Use binary mode for non-text files
ftp> binary                            # ✅

# Be polite with recursive downloads
wget -r -w 2 --limit-rate=500k URL     # ✅

# Verify downloads with checksums
sha256sum file.zip                     # ✅

# Use -O to control the output name
wget -O report.pdf 'https://example.com/download?id=123'  # ✅

# Run wget in the background for big files
wget -b 'https://example.com/big.iso'  # ✅

Don’t Do This:

# Don't use plain FTP for sensitive data
ftp user@host                          # ❌ plaintext

# Don't forget binary mode for archives
ftp> get archive.tar.gz                # ❌ may corrupt

# Don't recursively download a whole site carelessly
wget -r 'https://example.com/'         # ❌ may hammer server

# Don't store passwords in scripts
wget --http-password=secret URL        # ❌ visible in ps

# Don't ignore checksums
wget 'https://example.com/important.iso'  # ❌ verify it!

# Don't use FTP when SFTP is available
ftp user@host                          # ❌ use sftp

Common Pitfalls

PitfallProblemSolution
ASCII mode on binary fileCorrupted downloadUse binary
Forgot -c on a big fileRestart from zeroUse wget -c
FTP blocked by firewallConnection times outUse SFTP/HTTPS
mget prompts each fileSlowType prompt to toggle
Recursive wget fills diskDisk fullUse --limit-rate, -w
Password visible in psSecurity leakUse .netrc or --ask-password
No checksumSilent corruptionVerify with sha256sum
FTP over public Wi-FiCredentials stolenUse SFTP/FTPS

Real-World Examples

1. Download a File with wget

$ wget 'https://example.com/installer.run'
$ chmod +x installer.run

2. Resume a Large Download

$ wget -c 'https://example.com/ubuntu-22.04.iso'
...
ubuntu-22.04.iso  45%[=======>           ]  2.25G  4.5MB/s    eta 5m 12s

3. Download Multiple Files from a List

$ cat urls.txt
https://example.com/file1.zip
https://example.com/file2.zip
https://example.com/file3.zip

$ wget -i urls.txt -P downloads/

4. Download with Authentication

$ wget --http-user=kronos --http-password=secret123 https://example.com/protected.txt

5. Connect to an FTP Server and Download

$ ftp 52.175.95.215
Name: kronos
Password:
ftp> binary
ftp> get backup.tar.gz
ftp> bye

6. Upload Multiple Files to FTP

$ ftp 52.175.95.215
ftp> binary
ftp> mput report1.pdf report2.pdf report3.pdf
ftp> bye

7. Mirror a Website (Polite)

$ wget -r -w 2 --limit-rate=500k -np 'https://example.com/docs/'

8. Download in the Background

$ wget -b 'https://example.com/bigfile.iso'
Continuing in background, pid 12345.
Output will be written to 'wget-log'.

$ tail -f wget-log
...

9. Verify a Download

$ wget 'https://example.com/ubuntu.iso'
$ wget 'https://example.com/ubuntu.iso.sha256'
$ sha256sum -c ubuntu.iso.sha256
ubuntu.iso: OK

10. Use a .netrc File for Credentials

$ cat ~/.netrc
machine example.com
login kronos
password secret123

$ chmod 600 ~/.netrc
$ wget 'https://example.com/protected.txt'
# ✅ credentials read from ~/.netrc

Visual: FTP vs wget

┌──────────────────────────────────────────────┐
│              FTP (Interactive)               │
│                                              │
│  $ ftp 52.175.95.215                         │
│  Name: kronos                                │
│  Password: ******                            │
│                                              │
│  ftp> ls           ← browse                  │
│  ftp> cd pub       ← navigate                │
│  ftp> get file     ← download                │
│  ftp> put file     ← upload                  │
│  ftp> delete file  ← manage                  │
│  ftp> bye          ← exit                    │
│                                              │
└──────────────────────────────────────────────┘

┌──────────────────────────────────────────────┐
│           wget (Non-Interactive)             │
│                                              │
│  $ wget 'https://example.com/file.zip'       │
│  --2024-01-15 10:30:00--  ...                │
│  Saving to: 'file.zip'                       │
│                                              │
│  file.zip 100%[========>] 10.00M 5.2MB/s     │
│                                              │
│  (no prompt — just downloads)                │
│                                              │
└──────────────────────────────────────────────┘

Summary

Command / OptionPurposeExample
ftp HOSTConnect to FTP serverftp 52.175.95.215
helpList FTP commandshelp
get FILEDownload a fileget readme.txt
put FILEUpload a fileput report.pdf
mget F1 F2Download multiplemget a.txt b.txt
mput F1 F2Upload multiplemput a.pdf b.pdf
delete FILEDelete a filedelete old.txt
mdelete F1 F2Delete multiplemdelete a.txt b.txt
mkdir DIRCreate a directorymkdir newfolder
rename OLD NEWRename a filerename a.txt b.txt
bye / exitDisconnectbye
wget URLDownload a filewget 'http://x.com/f'
wget -O FILE URLRename outputwget -O a.zip URL
wget -c URLResumewget -c URL
wget -b URLBackgroundwget -b URL
wget -i FILERead URLs from filewget -i urls.txt
wget -r URLRecursivewget -r URL
wget -w N URLWait N secondswget -w 5 URL
wget --http-user=U --http-password=P URLHTTP authwget --http-user=k --http-password=s URL

Key takeaways:

  • ftp opens an interactive session — browse, upload, download, and manage files on a remote server
  • Use binary mode for non-text files (archives, images, executables)
  • Use mget, mput, mdelete for multiple files
  • wget is non-interactive — perfect for scripts and automation
  • wget supports HTTP, HTTPS, and FTP
  • Use -c to resume, -O to rename, -b for background, -i to read URLs from a file, -r for recursive
  • FTP is insecure (plaintext) — prefer SFTP or HTTPS for anything sensitive
  • Always verify downloads with checksums when possible
  • Use .netrc to store credentials instead of passing them on the command line

Remember: ftp is for interactive file management on a remote server; wget is for pulling files down non-interactively. Set binary mode before transferring anything that isn’t plain text. Use wget -c for large downloads so you can resume after a failure. Skip plain FTP when security matters — reach for sftp, scp, or HTTPS instead. Master these two, and you can move files across a network from the command line.


Stop using slow, ad-bloated tool sites! 🤮

🔎 Search “KandZ Tools” on Google to use many professional utilities for free.

KandZ.me is the ultimate minimalist hub for:
✅ Finance (Mortgage, Interest, Inflation)
✅ Tech (Base64, JSON, Dev Suite, IP)
✅ Health (BMI, BMR, TDEE)
✅ Productivity (Timer, Workspace, QR)

⚡️ Fast & Private
🔒 No data leaves your device
💎 100% Free

🔗 Use it now: https://tools.kandz.me
🔖 Bookmark it—you’ll need it later!