Advanced Networking

What is Command Line FTP? FTP stands for File Transfer Protocol and is a member of the TCP/IP group of protocols. Its main purpose is to transfer files between two computers. Although files can be transferred in Windows Explorer using network shares (see File Sharing under Windows 9x), FTP is useful where a secure log-in is required and is most often used for uploading web pages to a web server. The Command Line bit means that the FTP session is actually controlled from a Command Prompt window, rather than from a graphical program such as CuteFTP.

So why bother with the Command Prompt, when there are such handy applications such as Cute and WS-FTP which allow for dragging and dropping of files in a GUI interface? Well these programs may not always be available. Additionally, using the command line is actually faster for quick jobs, once you've mastered a few simple commands. And we're not only talking MS-DOS or DOS emulation; once you know the routine, these skills are equally useful under other command line environments such as Linux and Unix. Here examples using MS Windows are shown.

A Few Simple Commands

To invoke the Command Prompt, click on the START button, select RUN and in the Run box type COMMAND (Win 9x) or CMD (WinNT/2K/XP) and press OK:

Start | RUNType COMMAND or CMD

The ensuing black box is what we call a Command Prompt Window. It can be made full screen size and toggled back to a windowed view by holding down the ALT button and pressing ENTER. To connect to another computer using FTP, the other machine must be running an FTP service. Additionally you will require a valid username and password. To connect to the FTP Server, type the command FTP followed by the server's name or IP Address:

C:\>FTP 10.0.0.10

This will initiate an FTP session and attempt to connect to the other machine. If you forget to type the IP or computername and simply type FTP on its own, this will start the session but of course there will be no machine to connect to. The prompt will change from the familiar C:\> to FTP>. Here you can use the open command followed by the IP or computername:

FTP>open 10.0.0.10

Remember DOS is not case sensitive so it doesn't matter what case you use for commands. You will be prompted for a username and password. If you screw up the user or password then you don't need to start all over again. Simply type the comand USER followed by the username again and you will again be prompted for a password. Once authenticated, you're ready to go my hard-rockin' amigos..

The FTP Logon requires a valid username and password for the FTP Server:

FTP Logon


If the logon fails, check the username and password are correct. If they are, ping the FTP Server's IP Address to make sure you are able to talk to it:

Do the Ping thing

Post-Login Routines

After logging-in I usually like to start with a few commands which shape the FTP session. FTP uses ASCII and BINARY modes of file transfer. ASCII is the default and is used for transferring clear text files. Binary Mode is needed for transferring executable files. The BIN command puts you into Binary Mode. Transferring executables in ASCII mode will corrupt them. The HASH command gives you a file transfer progress meter in the form of hash characters shooting across the screen..

Routine commands

The PWD command comes from Unix and stands for Print Working Directory. Remember the file transfer process is happening between two computers. Your machine is the FTP Client and is referred to as the local machine. The FTP Server is referred to as the remote machine. The PWD command shows you which directory you are logged into remotely, i.e. on the FTP Server.

By default, any file transfers from the server will be downloaded to the directory you were logged into at the Command Prompt when you started the original FTP session. If you're anything like me, you wouldn't have noticed which directory this was on the local machine because you were busy thinking about lunch or that next holiday in Queensland. No worries. In any case it's good policy to specify the local download directory, using the LCD command (Local Change Directory) followed by the full path to the destination download location, as shown above.

Remote and Local machines

Some FTP Servers emulate DOS and some emulate Unix, so the commands you use in the FTP session can be either DOS, Unix or a mish-mash of the two. Sometimes you can use either. For instance the DOS DIR Command will provide a directory listing and so will the Unix LS Command. Changing the (remote) directory is achieved with the usual CD Command and the trusty CD .. will take you up one directory level at a time.

Help!

OK so far? If not, don't fret for help is at hand. In fact, from the FTP session simply type HELP. This will give you a list of available FTP commands. By typing HELP followed by the command name, you can get information relating to any FTP command. Don't hold your breath though:

FTP's HUGE Help

As can be seen from above, Command Prompt FTP help doesn't. In fact it's about as useful as a one-legged man at an arse kicking party. For a better listing of FTP Commands and explanations, go to Start | Help and type FTP COMMANDS in the search field under the SEARCH Tab.

Alternatively, take a look at this FTP Command Switches reference.

Time to Transfer

There are two ways for the files to travel: from the FTP Server (download) and to the FTP Server (upload). To send a file, use the PUT command as in put filename. To receive a file, use the GET Command as in get filename.

And that's about it. Everything you wanted to know about Command Line FTP but were afraid to ask.

- A.


andystechpage.com
Put 09.07.2003 | | Refresh Page |