Maybe you don't have any other ftp client available.
Maybe you don't want to be slowed down by windows, graphics and mice.
Maybe you want the fun of doing things old-skool.
Maybe you want to look like you know a lot more about technical computer operations than other people around you.
A command-line FTP client can usually be found on any machine: open a command prompt and type ftp.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Syntax
Command line syntax generally works like this:
Command SPACE argument
Some commands will take multiple arguments, e.g:
Each line is stored in the keyboard buffer until you hit RETURN (ENTER), then the command is executed.
In this image I have typed ftp (the remote machine) then hit RETURN.
The client then tells me that I'm connected and to what machine, including the IP address
It's then asking me for a user login.
"Remote" means the server you are connected/connecting to.
"Local" means the computer you are sitting in front of, or otherwise logged-on to in the first instance.
I'm using a Microsoft FTP client, but since the protocol goes way back into UNIX they are all quite similar.
Step 2: Connecting
You can either type ftp (remote machine) RETURN or type ftp RETURN, then open (remote machine)
The remote machine can be specified by IP address or web address. If you are connecting on a local network you can use the computer name.
By default FTP attempts to log the user in to the FTP server.
You will of course need a login and password to connect to a remote machine as you would using any other FTP client.
Enter your username RETURN
Enter your password RETURN
(This MS FTP client does not show any characters when you type the password.)
Notice the ftp> prompt.
Step 3: Navigating
There are three main commands for navigating the remote file system:
dir which displays a list of the current remote directory's files and sub-directories (first image)
ls which displays an abbreviated list (second image)
cd - meaning change directory.
cd (directory) will move you into that directory.
cd .. will move you up the tree into the previous directory (note that in the second image .. is displayed as a directory listing, as is . (the current directory).
In image 2 I've changed directory to "www" at the top, then used ls.
Compare images 1 and 2:
dir lists the permissions on the left, e.g. BJ is a directory (d) I have readwriteexecute permission, groups have read and execute, others just execute.
Notice that for the files (e.g. jpg) only I have rw, everyone else has r only.
ls lists the same but without details.
To do the same on the local machine use the following syntax:
Step 4: Download
To download a file use:
You can rename the file which you are creating on the local machine by typing:
get (filename) (new local filename)
mget allows you to retrieve multiple files in one command line, e,g,:
mget (filename1) (filename2) (filename3)
Note that you can't rename these locally because of the syntax.
The downloaded files will be created in the current local directory, so make sure you know where you are locally (previous step).
Image 1 shows the retrieval of "tony.jpg"
It ends up in the root of partition 1 C:\ because that's the local directory I was in at the time (see image 2).
Step 5: Upload
Make sure you are in the local directory from which you wish to upload - using ! dir and lcd, and in the correct remote directory.
Use put (filename) to transfer a local file to the remote directory
Like get you can rename the file which you are creating on the remote machine by typing:
put (filename) (new remote filename)
Like mget mput can be used to upload multiple files:
mput (filename1) (filename2) (filename3)
In image 1 I've used ! dir to list the contents of a local directory (the path is shown at the top of the window, it contains images of "Mr Shiraz").
Then I've used put to upload the file MS1.jpg
In image 2 I've used ls to show me what's in the remote directory, and you can see MS1.jpg at the bottom of the listing.
Step 6: Create / Delete
Make sure you are in the correct local and remote directories.
mkdir (remote directory) will create a directory on the remote machine.
rmdir (remote directory) will delete that directory on the remote machine.
delete (remote filename) will delete that file on the remote machine.
(note delete * will, to the best of my knowledge and experience, delete every file in the remote directory, but I cannot motivate myself to actually test it. Be very careful using wildcards "*" in the command-line unlike windowed interfaces it doesn't ask you if you're sure - it just does it.)
Similarly mdelete (remote filename1) (remote filename2) (remote filename3) will delete multiple files on the remote machine.
In this image I've followed a remote ls with a delete command, then used ls again to show that MS1.jpg has been deleted.
Step 7: Bye!
To end the client you can type:
bye and it will say "Goodbye" to you (this is old-skool programming, probably some old academic with a beard put that in the program...)
Use disconnect which leaves you with the FTP client running, such that you can use open for another connection.
Step 8: Advanced
This page is one that lists all MS FTP commands.
This page is one source of the relevant Linux
This page is one source of the relevant Mac OS-X
Some of the advantages of command-line work:
You don't need a high-spec machine.
You don't need a mouse.
You are not encumbered by graphics and dialogue-boxes.
You can work much more efficiently without the above.
You have a deeper understanding of how things work.