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.
| Command | Description |
|---|---|
ftp 52.175.95.215 | Connects to a remote server |
help | Displays all supported commands |
exit | Logs off the remote server |
cd | Change directory on the remote server |
cdup | Go up one directory on the remote server |
delete | Delete a file on the remote server |
idle | Set idle timeout |
image | Set binary transfer mode |
lcd | Change directory on the local machine |
mdir | List multiple remote directories |
mget | Download multiple files |
put | Upload 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
helpat theftp>prompt to see the full list. Typehelp COMMANDfor details on a specific command.
b – ftp examples
Once connected, you use FTP commands to move files around. Here are the most useful ones:
| Command | Description |
|---|---|
get filename /local/path/to/save/file | Downloads a file |
put /local/path/to/save/file filename | Uploads a file |
delete filename | Deletes a file |
mdelete file1 file2 file3 | Deletes multiple files |
mkdir directoryName | Creates a directory |
mget file1 file2 file3 | Downloads multiple files |
mput file1 file2 file3 | Uploads multiple files |
rename old new | Renames 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? yfor each file in a multi-file operation. You can disable that withprompt(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.
| Command | Description |
|---|---|
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.txt | Provides authentication credentials |
Common options:
| Option | Description |
|---|---|
-b | Downloads in the background |
-r | Recursive download |
-i filename | Reads URLs from a file |
-w 5 | Waits 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--waitand--limit-rateto 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
| Command | Purpose |
|---|---|
ftp HOST | Connect to a server |
help | List commands |
ls | List remote files |
cd DIR | Change remote directory |
cdup | Up one remote directory |
lcd DIR | Change local directory |
pwd | Show remote directory |
get FILE | Download a file |
mget F1 F2 | Download multiple |
put FILE | Upload a file |
mput F1 F2 | Upload multiple |
delete FILE | Delete a file |
mdelete F1 F2 | Delete multiple |
mkdir DIR | Create remote directory |
rename OLD NEW | Rename remote file |
binary | Set binary mode |
bye / exit | Disconnect |
wget
| Option | Purpose |
|---|---|
wget URL | Download a file |
wget -O FILE URL | Save with a new name |
wget -c URL | Resume a download |
wget -b URL | Background download |
wget -i FILE | Read URLs from file |
wget -r URL | Recursive download |
wget -w N URL | Wait N seconds |
wget -q URL | Quiet mode |
wget --limit-rate=N URL | Limit speed |
wget --http-user=U --http-password=P URL | HTTP 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
| Pitfall | Problem | Solution |
|---|---|---|
| ASCII mode on binary file | Corrupted download | Use binary |
Forgot -c on a big file | Restart from zero | Use wget -c |
| FTP blocked by firewall | Connection times out | Use SFTP/HTTPS |
mget prompts each file | Slow | Type prompt to toggle |
| Recursive wget fills disk | Disk full | Use --limit-rate, -w |
Password visible in ps | Security leak | Use .netrc or --ask-password |
| No checksum | Silent corruption | Verify with sha256sum |
| FTP over public Wi-Fi | Credentials stolen | Use 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 / Option | Purpose | Example |
|---|---|---|
ftp HOST | Connect to FTP server | ftp 52.175.95.215 |
help | List FTP commands | help |
get FILE | Download a file | get readme.txt |
put FILE | Upload a file | put report.pdf |
mget F1 F2 | Download multiple | mget a.txt b.txt |
mput F1 F2 | Upload multiple | mput a.pdf b.pdf |
delete FILE | Delete a file | delete old.txt |
mdelete F1 F2 | Delete multiple | mdelete a.txt b.txt |
mkdir DIR | Create a directory | mkdir newfolder |
rename OLD NEW | Rename a file | rename a.txt b.txt |
bye / exit | Disconnect | bye |
wget URL | Download a file | wget 'http://x.com/f' |
wget -O FILE URL | Rename output | wget -O a.zip URL |
wget -c URL | Resume | wget -c URL |
wget -b URL | Background | wget -b URL |
wget -i FILE | Read URLs from file | wget -i urls.txt |
wget -r URL | Recursive | wget -r URL |
wget -w N URL | Wait N seconds | wget -w 5 URL |
wget --http-user=U --http-password=P URL | HTTP auth | wget --http-user=k --http-password=s URL |
Key takeaways:
ftpopens an interactive session — browse, upload, download, and manage files on a remote server- Use
binarymode for non-text files (archives, images, executables) - Use
mget,mput,mdeletefor multiple files wgetis non-interactive — perfect for scripts and automationwgetsupports HTTP, HTTPS, and FTP- Use
-cto resume,-Oto rename,-bfor background,-ito read URLs from a file,-rfor recursive - FTP is insecure (plaintext) — prefer SFTP or HTTPS for anything sensitive
- Always verify downloads with checksums when possible
- Use
.netrcto 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!