0% found this document useful (0 votes)
47 views

The Basics of FTP: Basic Order of Operations

FTP (File Transfer Protocol) allows users to transfer files between a local and remote network site. It involves opening a connection to the remote host, navigating directories, setting the transfer mode to ASCII or binary, and using commands like get, put, mget and mput to transfer files. Common FTP commands are used to open connections, change directories, list files, and transfer files. Screenshots provide examples of using commands like ftp, user, ls and dir.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

The Basics of FTP: Basic Order of Operations

FTP (File Transfer Protocol) allows users to transfer files between a local and remote network site. It involves opening a connection to the remote host, navigating directories, setting the transfer mode to ASCII or binary, and using commands like get, put, mget and mput to transfer files. Common FTP commands are used to open connections, change directories, list files, and transfer files. Screenshots provide examples of using commands like ftp, user, ls and dir.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

The Basics of FTP

FTP (File Transfer Protocol) allows a user to transfer files to/from a remote network site.

Topics: Basic Order of Operations | Commands | Example Screen Shots

Basic Order of Operations:

1. Change to your local directory where most (if not all) of the files you will be transferring are kept.
2. Open a connection to the remote host via the ftp command.
3. Once connected to the remote host, change to the directory (cd command) where the files are that
you are going to get or to the location where you are going to put files.
4. Set the transfer mode (ascii or binary).
5. Transfer the files (get, mget, put, mput).
6. Repeat steps 1, 3, 4, 5 as necessary.
7. Exit ftp with the bye command.

Commands:

● ftp [host] - open an ftp session with the specified host machine.
Examples:
C:\> ftp neserve0
C:\> ftp erols.erols.com

● open [host] - Establish a connection to the specified host when you're already at an ftp prompt.
Examples:
ftp> open neserve0
ftp> open erols.erols.com

● user [username] - Log into an ftp server when you're already connected in an ftp session.
Examples:
ftp> user dlozinsk
ftp> user anonymous

● ls [remote-directory] - Print a listing of the contents of remote-directory on the remote machine.


The listing includes any system-dependent information that the server chooses to include.
Examples:
ftp> ls
ftp> ls /usr/local/bin
Dave Lozinski's FTP Tutorial Page 1 of 10
http://www.davelozinski.com 2005-01-01
● dir [remote-directory] [local-file] - Print a listing of the contents in the directory remote-directory,
and optionally, placing the output in local-file.
Examples:
ftp> dir
ftp> dir /usr/local/bin

● help [command] - Print an informative message about the meaning of command. If no argument
is given, ftp prints a list of the known commands.
Examples:
ftp> help
ftp> help dir

● ? - synonym for help.


Examples:
ftp> ?
ftp> ? dir

● pwd - Print the name of the current working directory on the remote machine.Often times this
includes printing the full path.
Example:
ftp pwd>

● cd [remote-directory] - Change the working directory on the remote machine to remote-directory.


Examples:
ftp> cd /tmp
ftp> cd ../..

● lcd [directory] - Change the working directory to directory on the local machine. If no directory is
specified, the user's home directory is used.
Examples:
ftp> lcd c:\temp
ftp> lcd ../..

● ascii - Set the file transfer type to ASCII . Only use this transfer method for text-files. That is, files
ending in .txt, html files, and/or perl programs.
Example:
ftp> ascii

● binary - Set the file transfer type to support binary file transfer. Use this transfer method for
anything other than a textfile. For example, Word documents, pdf files, gifs, jpgs, java class files,
etc.
Example:
Dave Lozinski's FTP Tutorial Page 2 of 10
http://www.davelozinski.com 2005-01-01
ftp> binary

● put [local-file] - Put (upload) local-file to the remote machine. No wildcards!


Examples:
ftp> put index.html
ftp> put test.txt

● get [remote-file] - Retrieve (download) remote-file and store it on the local machine. No wildcards!
Can only get one file at a time.
Examples:
ftp> get index.html
ftp> get /tmp/readme.txt

● mput [local-files] - Expand wild cards in the list of local-files given as arguments and do a put for
each file in the resulting list. The list of files should be separated by spaces.
Examples:
ftp> mput *
ftp> mput *.html
ftp> mput *.html test.txt README

● mget [multiple files and/or wildcards] - Expand wild cards in the list of remote files given as
arguments and do a get for each file in the resulting list. The list of files should be separated by
spaces.
Examples:
ftp> mget *
ftp> mget *.gif
ftp> mget *.doc image.gif salaries*

● prompt - Toggle interactive prompting. Interactive prompting occurs during multiple file transfers to
allow the user to selectively retrieve or store files. If prompting is turned off, any mget or mput will
transfer all files, and any mdelete will delete all files.
Example:
ftp> prompt

● bell - Arrange that a bell be sounded after each file transfer command is completed.
Example:
ftp> bell

● delete [remote-file] - Delete the remote-file on the remote machine.


Examples:
ftp> delete test.doc
ftp> delete /tmp/temporary_file.txt

Dave Lozinski's FTP Tutorial Page 3 of 10


http://www.davelozinski.com 2005-01-01
● mkdir [new-directory-name] - create a directory new-directory-name on the remote machine.
Examples:
ftp> mkdir temp
ftp> mkdir /tmp/dave

● rmdir [directory-name] - Delete the directory entitled directory-name on the remote machine.
Examples:
ftp> rmdir temporary_directory
ftp> rmdir /tmp/test_dir

● rename [old-file-name] [new-file-name] - Rename the file old-file-name on the remote machine,
to the file new-file-name.
Examples:
ftp> rename index.htm homepage.html
ftp> rename /tmp/readme.txt /tmp/README_NOW.txt

● bye - Terminate the FTP session with the remote server and exit ftp. On Unix, an end of file should
also terminate the session and exit.
Example:
ftp> bye

● quote site chmod xxx [file name] - Change the permission modes of the file file-name on the
remote system to xxx mode. Note that the chmod command is not always implemented.

● get [file-name] "|more" - Instead of downloading and saving the file file-name on the local
machine, you view its contents. Only recommended to use with text files.

Example Screen Shots:

1. ftp and user


2. help and ?
3. ls and dir
4. pwd, cd, lcd, binary, put
5. mput, prompt, dir
6. rename, dir, delete, bye

Dave Lozinski's FTP Tutorial Page 4 of 10


http://www.davelozinski.com 2005-01-01
Dave Lozinski's FTP Tutorial Page 5 of 10
http://www.davelozinski.com 2005-01-01
Dave Lozinski's FTP Tutorial Page 6 of 10
http://www.davelozinski.com 2005-01-01
Dave Lozinski's FTP Tutorial Page 7 of 10
http://www.davelozinski.com 2005-01-01
Dave Lozinski's FTP Tutorial Page 8 of 10
http://www.davelozinski.com 2005-01-01
Dave Lozinski's FTP Tutorial Page 9 of 10
http://www.davelozinski.com 2005-01-01
Dave Lozinski's FTP Tutorial Page 10 of 10
http://www.davelozinski.com 2005-01-01

You might also like