Utilities: FTP

In the world of Windows, we’re accustomed to installing programs for specific functions, like FTP, email, and Secure Shell connections. With Linux and Unix, utilities are provided with the operating system, and are easily invoked from the command line.

ftp

The File Transfer Protocol (FTP) utility is an easy way to transfer files between computers.  All you need to do to make an FTP connection is issue the command ftp, and provide the hostname or IP address of a valid FTP server:

ftp some.server.com
or
ftp 123.456.789.0

You’ll arrive at an ftp> prompt where you can get or put files.

ftp Commands
help Lists available commands
pwd Prints current directory on remote computer
dir
ls
Lists directory on remote computer
cd <directory> Changes to <directory> on remote computer
lcd <directory> Changes to <directory> on local computer
get <filename>

Downloads <filename>
You can add “.gz” to the filename and automatically get compression!

put <filename>
send <filename>
Uploads <filename>
mget <filename1> … Multiple get: multiple <filenames> and wildcards
mput <filename1> … Multiple put: multiple <filenames> and wildcards
mdelete <filename1> … Multiple delete: multiple <filenames> and wildcards
close End the session on the remote computer, but stay in the FTP program
open <hostname> When you’re already in the FTP program, this opens a new remote host session
! Start a shell on the local computer
quit
bye
End your user session

ftp can be invoked very simply, provided that you have an account on the remote computer:

ftp hobbes.philosophers.com

And like mail, ftp opens an interactive session. Some commands are familiar, for instance cd to change directories and dir or ls to list files.

Use get <filename> to download files, and put <filename> to upload files. delete <filename> does what you’d expect.

Use bye or quit to exit.

You must be aware that classic ftp passes user names and passwords in plain text. Newer ftp programs (for instance vsftp) are much better, but the most secure file transfer you can perform will be using Secure Copy (scp).

SCP must be invoked from within an existing SSH session, and uses the simple syntax:

scp <filename>

See man scp for brief discussions of how individual files can have transfer permissions set (among other issues). But SCP is not hard to use, provided you can use SSH.