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.
ftp>
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:
lcd /home/user/directory_name
after setting up lcd, you can use the get command to download any file over FTP.
get some_file
To download multiple files use wildcards, e.g. to download all files with the .xls file extension.
mget *.xls
Upload files with FTP
To download files we use the put commans:
put some_file
or if not in the local directory
put /path-to/some_file
To uplaod multiple files at once, we use the mput command wildcard:
mput *.xls
Closing FTP connection
To close the FTP connection use one of the following commands:
exit
quite
bye