To connect to the FTP server, we have to type in the terminal window ‘ftp’ and then the domain name ‘domain.com‘ or IP address of the FTP server and port.
ftp example.com 21
you will be asked for username and password, add them when prompted., and you will see the message when logged in successfully:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
TIP: To connect to FTPS sites use the following command: ftp-ssl -pivz secure “$FTP_HOST” 990
Working with directories
The commands to list, move or create folders on FTP server are the same as on a local shel, ls stands for list, cd to change directories, mkdir to create directories…
Download files with FTP
To dosnlaod files we first need to setup local FTP file download directory using the lcd command:
after setting up lcd, you can use the get command to download any file over FTP.
To download multiple files use wildcards, e.g. to download all files with the .xls file extension.
Upload files with FTP
To download files we use the put commans:
or if not in the local directory
To uplaod multiple files at once, we use the mput command wildcard:
Closing FTP connection
To close the FTP connection use one of the following commands: