First of all we should know, what dose a protocol mean? A protocol is just a set of rules which should be followed while doing some work. In short protocol is a method of dealing with a certain subject. Now, what is this file transferring protocol (FTP)? Simple! It is a method of transferring files from one computer to another. Actually different computers have different methods to store a file so a common protocol was needed to transfer files between them and thus FTP came into the view. It is a set of complex rules which are followed by some programs to provide a better interface to transfer files here and there. There are many such programs but it is better to use the programs bundled (or packaged) with the operating system because they are easily available on every computer. They are not only bug-free but also free of cost bundled with the operating system. So for your ease I will first explain the FTP program for Windows 98/NT/2000:-
Click on Start->Run... type "ftp" (without quotes) then click OK. You will get a command prompt like this
ftp> _
Now from here you can give commands to get your work done.
If you don't know, what commands you may give here, you can take help by typing "help" (without quotes) and then enter.
ftp> help Commands may be abbreviated. Commands are: ! delete literal prompt send ? debug ls put status append dir mdelete pwd trace ascii disconnect mdir quit type bell get mget quote user binary glob mkdir recv verbose bye hash mls remotehelp cd help mput rename close lcd open rmdir ftp> _
You can also get summary of any command by entering "help [<command>]" or "? [<command>]". Suppose if you want to know about "lcd" then you can do one of the following.
ftp> help lcd lcd Change local working directory ftp> _OR
ftp> ? lcd lcd Change local working directory ftp> _
In this way you can get a brief description of the command. Actually '?' is an alias for "help" so you can use '?' anywhere in place of "help".
Whenever you want to transfer file(s) to/from a remote computer, At first you have to establish a connection between the two computers (Your computer & the remote computer). The command used to do this job is "open".
Usage: open [<remote computer's address>]You can leave the address parameter at the time of entering the command then it will ask for it as shown in the example below.
ftp> open jinni Give remote computer's address here address is "jinni". Connected to jinni. This message will appear after some time when connected. 220 jinni Microsoft FTP Service (Version 5.0). Server's Name will be printed. User (jinni:(none)): Ashutosh Give your login name here it is "Ashutosh". 331 Password required for Ashutosh. The server will ask for your Password. Password: Give your password here. It will not be displayed so be careful. 230 User Ashutosh logged in.If password is right it will display "logged in". ftp> _
After login successfully you can work on two computers or File-systems. One is obviously your own computer and other is the computer you have just connected to. So before doing anything make it clear in your mind that you will now deal with two computers. One is your own. We will refer it as "Local System" and the other one to which you have connected will be referred as "Remote System". Everything related to local system will be called "local" and everything related to remote system will be called "remote".
Once you are ready to transfer files from/to the remote system, you will have to move from one folder(Directory) to another for this purpose there are some commands. Using these commands you can traverse in the directories of local and remote systems. The commands are listed below.
| Command | Usage | Description |
|---|---|---|
| pwd | pwd | Print Working Directory. As the name indicates it prints the full path of current remote directory(Folder) |
Example:ftp> pwd 257 "/" is current directory. ftp> _ |
||
| cd | cd [<Remote Directory>] NOTE: ".." represents parent directory |
Changes the current remote directory(Folder) |
Example:ftp> cd menu 250 CWD command successful. ftp> _ |
||
| lcd | lcd [<Local Directory>] NOTE: ".." represents parent directory |
Changes the current local directory(Folder). Without any parameters it prints the full path of current local directory(Folder) |
Example:ftp> lcd Local directory now C:\. ftp> lcd menu Local directory now C:\menu. ftp> _ |
||
| ls | ls [-<Options>] Options: -l Long Format -t Sorted by Time (All option of UNIX) |
Lists all files in the current remote directory(Folder) |
Example:ftp> ls -lt 200 PORT command successful. 150 Opening ASCII mode data connection for /bin/ls. -rwxrwxrwx 1 owner group 6484 Jun 17 20:07 menu.html -rwxrwxrwx 1 owner group 2504 Jun 17 20:07 menuimg.html -rwxrwxrwx 1 owner group 1308 Jun 17 20:07 SOFT1.GIF -rwxrwxrwx 1 owner group 1165 Jun 17 20:07 SOFT2.GIF 226 Transfer complete. ftp: 931 bytes received in 0.83Seconds 1.12Kbytes/sec. ftp> _ |
||
| dir | dir | Same as "ls -l" |
| Example: Same as "ls" |
||
| mls | mls [<Remote files or Directory>][<Local file>] | List contents of multiple{using metacharacter} remote directories into a local file |
Example:
ftp> mls * list.txt
output to local-file: list.txt? Change the filename or just press ENTER
200 PORT command successful.
150 Opening ASCII mode data connection for file list.
226 Transfer complete.
ftp: 349 bytes received in 0.03Seconds 11.63Kbytes/sec.
ftp> _ |
||
| mdir | mdir [<Remote files or Directories>][<Local file>] | Much like the "mls" but you can not give more than 2 directories |
Example:
ftp> mdir title menu list.txt
output to local-file: list.txt? Change the filename or just press ENTER
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
226 Transfer complete.
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
226 Transfer complete.
ftp: 931 bytes received in 0.59Seconds 1.58Kbytes/sec.
ftp> _ |
||
Here are two commands{dir & mdir} which are same as the the other {ls & mls}. These are here just for the sake of comfort but I will recommend "ls & mls" because they are more powerful.
Now when you know how to move within the file-system {directories} of both local and remote systems, you can easily determine and move to the desired directories. All commands transfer files from current local directory to current remote directory. So first use "lcd" and change to the local directory which contains files to be transferred then change your remote directory and go to the directory where you have to send the files, using the "cd" command. Now use the following commands to upload your files.
But before going to those commands I would like to tell you about some other commands that affects the way of transferring or the environment.
| Command | Usage | Description |
|---|---|---|
| ascii | ascii | Change the transfer mode to ASCII. Better for transferring text files. Default:ascii See Also: type |
Example:ftp> ascii 200 Type set to A. ftp> _ |
||
| binary | binary | Change the transfer mode to Binary. Better for transferring Picture files like JPEG, GIF or other non-text files like EOT, SWF etc. It can also be used for text files if the remote system has the same text format. Default:ascii See Also: type |
Example:ftp> binary 200 Type set to I. ftp> _ |
||
| bell | bell | Toggle the Bell mode. When on, it beeps on the completion any command. Default:off |
Example:ftp> bell Bell mode On . ftp> _ |
||
| debug | debug | Toggle the Debug mode. When on, it prints extra information including the internal FTP command while running any command. Good for advanced users. Default:off |
Example:ftp> debug Debugging On . ftp> _ |
||
| glob | glob | Toggle the Globbing mode. When on, it enables you to use metacharacters, '*' and '?' to specify multiple files like if you want to specify all HTML files you would say "*.html". For more details about metacharacters click here Default:on |
Example:ftp> glob Globbing Off . ftp> _ |
||
| hash | hash | Toggle the Hash mark printing. When on, it prints a `#' for each buffer transferred. Works like a progressbar. Default:off |
Example:ftp> hash Hash mark printing On ftp: (2048 bytes/hash mark) . ftp> _ |
||
| prompt | prompt | Toggle the Interactive mode. When on, it confirms for every file {or command}, where multiple files {or commands} are specified. Default:on |
Example:ftp> prompt Interactive mode Off . ftp> _ |
||
| type | type [ascii | binary] | Sets the transfer mode to ASCII or Binary. It prints current mode if invoked without any parameters. Default:ascii See Also: ascii, binary |
Example:ftp> type Using ascii mode to transfer files. ftp> type binary 200 Type set to I. ftp> _ |
||
| status | status | Shows all the values set by the above commands. Useful to quickly take a look at the current settings. |
Example:ftp> status Connected to jinni. Type: ascii; Verbose: On ; Bell: Off ; Prompting: On ; Globbing: On Debugging: Off ; Hash mark printing: Off . ftp> _ |
||
Now set your environment then change to appropriate local and remote directories and start transferring files using the following commands.
| Command | Description | Usage |
|---|---|---|
| append | append [<Local File>][<Remote File>] | Append a local file to the remote file. If the remote file is not given, it assumes the same name as the locale file's name. If remote file dose note exist it will be created. |
Example:ftp> append menuimg.html menu.html 200 PORT command successful. 150 Opening ASCII mode data connection for menu.html. 226 Transfer complete. ftp: 2504 bytes sent in 0.02Seconds 125.20Kbytes/sec. ftp> _ |
||
| get | get [<Remote File>][<Local File>] | Downloads a remote file. The name of remote file will be used for local file if local file name is not given. |
Example:ftp> get menu.html 200 PORT command successful. 150 Opening ASCII mode data connection for menu.html(8988 bytes). 226 Transfer complete. ftp: 8988 bytes received in 0.11Seconds 81.71Kbytes/sec. ftp> _ |
||
| mget | mget [<Remote Files>] | Downloads multiple{using metacharacter} remote files. See Also: glob |
Example:ftp> mget menu*.???? 200 Type set to A. mget menu.html? Type 'n' before pressing ENTER to skip this file. 200 PORT command successful. 150 Opening ASCII mode data connection for menu.html(8988 bytes). 226 Transfer complete. ftp: 8988 bytes received in 0.02Seconds 449.40Kbytes/sec. mget menuimg.html? Type 'n' before pressing ENTER to skip this file. 200 PORT command successful. 150 Opening ASCII mode data connection for menuimg.html(2504 bytes). 226 Transfer complete. ftp: 2504 bytes received in 0.00Seconds 2504000.00Kbytes/sec. ftp> _ |
||
| put | put [<Local File>][<Remote File>] | Upload a local file to the remote file. If the remote file is not given, it assumes the same name as the locale file's name. If remote file dose note exist it will be created else it will be overwritten. |
Example:
ftp> put home1.gif
200 PORT command successful.
150 Opening BINARY mode data connection for home1.gif.
226 Transfer complete. Note the mode, used here to upload a GIF file.
ftp: 1198 bytes sent in 0.02Seconds 59.90Kbytes/sec.
ftp> _ |
||
| mput | mput [<Local Files>] | Uploads multiple{using metacharacter} files to the remote system. You will mostly use this command. It will not ask for each file if prompt is off See Also: glob, hash, prompt |
Example:ftp> mput *.html mput menu.html? Type 'n' before pressing ENTER to skip this file. 200 PORT command successful. 150 Opening ASCII mode data connection for menu.html. 226 Transfer complete. ftp: 8988 bytes sent in 0.03Seconds 299.60Kbytes/sec. mput menuimg.html? Type 'n' before pressing ENTER to skip this file. 200 PORT command successful. 150 Opening ASCII mode data connection for menuimg.html. 226 Transfer complete. ftp: 2504 bytes sent in 0.02Seconds 125.20Kbytes/sec. ftp> _ |
||
| recv | recv [<Remote File>][<Local File>] | Same as get |
| Example: Same as get |
||
| send | send [<Local File>][<Remote File>] | Same as put |
| Example: Same as put |
||
! delete literal prompt send ? debug ls put status append dir mdelete pwd trace ascii disconnect mdir quit type bell get mget quote user binary glob mkdir recv verbose bye hash mls remotehelp cd help mput rename close lcd open rmdir
Note:- Still more to be written about:
![]() |
![]() |
![]() |