Most Linux distributions have this installed by default. If not, install it using your package manager (e.g., sudo apt install ftp ).
lcd (Local Change Directory): Sets the directory on your local machine where files will be saved.
If you need to download multiple files, such as all files ending in .log or .csv , you can use mget inside the heredoc.
#!/bin/bash # --- Configuration --- HOST="ftp.example.com" USER="username" PASS="password" REMOTE_DIR="/logs" LOCAL_DIR="/home/user/downloads/logs" # --- FTP Transfer --- ftp -n -i "$HOST" < Use code with caution.