Skip Navigation.

NWE Help: Remote: Ftp: Command Line FTP: Example

NWE Home :: Help :: Remote :: FTP :: Command Line FTP

Since command-line FTP can be a little confusing, we've included an example here that shows how a student might use FTP to save her work into another filespace.

Our example

Lyra wants to save her NWE files into her plaza space, provided by Gatorlink. Follow along as she uses command-line FTP to connect to the plaza server and transfer her files.

Open a shell and connect to the remote server

First, Lyra needs to open a command-line window, or shell. It is from the shell that she will be able to FTP to the plaza server.

  1. To open a shell, Lyra must choose "Local XTerm Shell" from the NWE Menu. A window will open that a prompt.

  2. To connect to the plaza server, Lyra must type the following at the prompt. (If you want to connect to a different server, be sure to substitute its name as needed.)
    ftp plaza.ufl.edu

    Lyra enters her username and password and then finds herself logged into the plaza server.

Make sure the shell is in the right place

Before Lyra does any commands, she needs to make sure she's in her public_html directory. Once she is, she can list the directory to see what files she wants to copy.

  1. First, Lyra needs to type !pwd at the FTP prompt. Just before she presses enter, her shell looks like this:
    ftp> !pwd

    After she presses enter, the shell tells her the "working directory" of her shell. She sees:
    ftp> !pwd
    /home/nwe/lsilvert/
    ftp>


    This means she's in her "home" directory.

  2. Since Lyra wants to transfer her web files, she needs to switch to her public_html directory. To do so, she must type lcd public_html. This command should transfer her local terminal to the public_html directory.

  3. Lyra also makes sure her remote shell is at the right place by using the commands cd and pwd.

List and transfer files

To tranfer her files, Lyra should "list" them first, then can transfer them one at a time or all together.

  1. The command Lyra types to list her local files is: !ls. When she types it, her shell looks like this:
    ftp> !ls
    dust.html       index.html      images/            pantlaemon.gif
    dust.html.bak   index.html.bak  jordancollege.sw
    ftp>
    Above is the list of files Lyra has in her public_html directory. Now she can choose whether to transfer some or all of the files. To see a list of files Lyra has in her directory on the plaza server, she would type ls

  2. Before transferring files, Lyra sets FTP to binary mode so that any non-text files she transfers will be transferred smoothly. To set FTP to binary mode, she just has to type bin. After she does, the xterm window displays the following:
    ftp> bin
    200 Type set to I.
    ftp>

  3. To transfer one file, Lyra must type the transfer command and the name of the file, like this:
    ftp> put dust.html

    The command above would transfer her file, "dust.html," to the plaza server. The shell then gives an output like this:
    ftp> put dust.html
    200 PORT command successful.
    150 Opening ASCII mode data connection for dust.html.
    226 Transfer complete.
    local: dust.html remote: dust.html
    2449 bytes sent in 0.00074 seconds (3218.84 Kbytes/s)
    ftp>
    While the numbers may differ somewhat, the output should be similar.

  4. Lyra may want to transfer ALL her files in one go. To do this, she needs to use the command mput *.*. By doing so, she instructs the FTP program to do a "multiple put" of all files that match the *.* construction (meaning any file with an extension).

    The FTP program will confirm each transfer as it does them.

Logging out of command-line FTP

Now that Lyra has transferred her files, she is ready to disconnect from the remote server.

  1. She checks to make sure the files have transferred by typing the command ls and examining the output. Her output looks like this:
    ftp> ls
    200 PORT command successful.
    150 Opening ASCII mode data connection for file list.
    dust.html       index.html      jordancollege.sw 
    dust.html.bak   index.html.bak  pantlaemon.gif
    226-Transfer complete.
    226 Quotas on: using 903.00 of 20000000.00 bytes
    12 bytes received in 0.013 seconds (0.91 Kbytes/s)
    ftp>
    Since all the files she wanted to transfer are there, she knows everything worked out.
    NOTE: If Lyra wanted to transfer the files in the "images/" directory, she would need to create a directory on the remote server and then follow the same steps she followed in transferring files from her public_html directory.

  2. Now that she is done transferring files, she can log out of the remote system by typing bye.

Now that you have seen Lyra transfer files, we hope that you will be able to do so as well. To find a list of the commands for FTP, see our introduction page.