FIT 100

Lab 2: Creating Directories and

Navigating Directory Structures in a Command Line Environment, Part 2

(or, Where am I, where are my files, and how do I put my files somewhere else?)

Spring 2001

 

Introduction:

Welcome to the second lab of FIT 100.  The topics covered in today’s lab are similar to your first lab, however the environment is slightly different. 

 

You will want to get into the habit of bringing a floppy disk or zip disk as an additional storage device for your work.  What you learn in today’s lab will always allow you to store documents in your remote account (Dante), but it doesn’t hurt to always have a back up.

 

What other reasons are there for using our Dante accounts for storage instead of a relying solely on a floppy or zip disk?

·         A large storage space for you work

·         You don’t have to carry around a disk or being physically located at a machine holding your work.  You can work at a different machine each time.

·         Your floppy may be damaged carrying it in your backpack!!!!!!!

 

Our first lab covered FTP, creating and moving directories, and understanding where we were at all times when moving and saving files.  The software you used, WS-FTP, is a graphical user interface (GUI).  In a GUI you manipulate images or icons and click on buttons to use the software.  A command line interface requires you to know and use a fixed set of commands in order to manipulate files and folders and to move them from location to location. 

 

Today, you will be doing the same tasks (accomplish the same functionality), but with a different interface.

 

Objectives:

1.      To become comfortable with using the command line prompt to navigate directory structures and access folders stored in different remote locations.

2.      To understand the concept of directory location and it’s impact on retrieval.

3.      To understand that there are many ways to access our directories.  Today’s lab will explore the ways to FTP files using command language.

4.      To understand that functionality is separate from the interface. 

5.     To explore the difference between a command line and a GUI interface.

 

What we know:

 

New skills:

 


TO DO:

Create a file to use as a sample document to move back and forth with ftp

 

  1. Similar to the last lab, open up Word and create a document called secondlab.doc
  2. Save it at this location:  C:\Documents\

 

This will be the test file to move back and forth from a local directory to a remote directory in your account.

 

Create a Directory remotely using ftp

The way that we move files between local and remote directories is by using ftp, or File Transfer Protocol.  This is one way to get to the command line interface: 

1.      Click on the Start Button in the lower left of your machine.  Select the Run… option.

 

2.      You are going to ftp to Dante, so enter the following in the window:

o        ftp dante.u.washington.edu

 

NOTE:  This is just one way of getting to the command prompt shown in the next image.  You will discover others as you learn more.

 

 

 

The next window you will see after clicking ok will prompt you for your User ID and password:

 

 

Enter your UserID and Password.  When you finish, you will be placed in the root directory of your Dante account. 

 

We want to move into the directory that will hold all our future lab work.  Last lab you created a folder called FIT100LABS inside of a folder called FIT100.  To see if it FIT100 is there, and view the contents of your remote account, type in the ls command and hit return:

 

 

After seeing that the FIT100 folder is there, change directories to that folder:

·         cd  FIT100

**Notice that this environment demands your understanding of the Unix commands that will make folders, move folders and bring in folders or files from other locations.  See the back sheet for a basic list of ftp (Unix) commands. ** 

If you get lost and need to find out where you are in your remote directory, go to the help section at the end of this lab. 

 

 
 

 

 

 

 

 

 

 


3.  Use your ls command again to see the folders that are inside of your FIT100 folder/directory.  Now, change directories (cd) again to your FIT100Labs directory.

·         cd FIT100Labs

**Note that if you use capital letters in your folder name, you must use them when you send the command to change directories.

 

 

4.  Create a directory called Lab_2 in FIT100Labs with the following command:

·         mkdir Lab_2

 

 

·         You’ve created a directory inside FIT100Labs which sits inside of FIT100 which sits at the root of your Dante account. 

 

So the structure of your folders for FIT100 in your remote account should now be:

 

 

 

 

 

 

 

 

 

 

 

 

 


·         Using the change directory command to move into the Lab_2 directory:

cd  Lab_2

 

4.  Now identify the local directory you want to copy files to or from.  At the ftp prompt you should now identify the local directory (on the machine in front of you) you wish to use.  For this lab, that will be the Documents folder, which sits within the C drive.  Type in:

·         lcd C:/Documents
and press <Enter>

In this command, L stands for “local”

 

 

This environment doesn’t recognize spaces.  For ease of use with your files and folders, it is best not to include spaces in your file or folder names.  If you have to change directories to a folder that includes a space in the name, you can use the truncation symbol to do so.  For example, to switch to C:\My Documents, enter lcd C:\My*.

 

 

You now have indicated the start and end locations for your file transfer.  Lab_2 in your remote account and C:\Documents on the local machine.

 

 

5.  Get or put commands?

1.      Get will copy a file from your remote directory to the local directory

2.      Put will copy a file from your local directory to the remote directory

 

**In the last lab, you had to make sure the files were sent as certain types.  The same applies here.  Is this file ASCII or Binary?  Look at your ftp commands on the last page: how do you change the transfer mode?**

 

Answer:  The transfer mode should be binary.  At the ftp prompt, type in binary and press return.

 

6.  Take the file on your local C drive and PUT it into your Dante account. 

o        put secondLab.doc

 

7.  Now use your ls command to list the files in your Lab_2 directory to check for that newly copied file.

 

8.  A benefit of using the command line interface is that you can go from the root of your directory structure all the way to the deepest folder with one command if you choose.  Up until now, you have moved up and down your account one level at a time using the cd command.  Now we will move from inside the Lab_2 folder and go into one of our Project folders in one step.

 

A shortcut to move back to your home directory would be to enter the following command:

o        cd  ~Your_UWNetID

 

This takes you to your root directory.  Add in the rest of the path that you want to move down.  So for example, if I want to move from the Lab_2 folder location to the Project3 folder that is sitting inside of FIT100Projects.  I would enter the following:

 

o        cd  ~gbwhit23/FIT100/FIT100Projects/Project3

 

Using cd to move from your current location in folder Lab_2 to the new location of the Project 3 folder.

 

To show you have an understanding of the concepts covered in this lab:

 

9.  Show your TA the full path to your Lab_2 folder.  Then use the ls command to show

the secondlab.doc inside.

 

10.  Create another file on the local machine using Word.  FTP it into your Lab_2 folder on Dante.  After checking to see that you were successful, DELETE the remote file using one of the commands on your list.  (In this environment, you can only use ftp to delete remote files and folders, not local ones).  Be very careful when you use this command!!!!!!!  Make sure you are in the right directory and naming the right file to delete.

 

11.  Try retrieving your secondlab.doc file from your Dante account and putting it into the local folder, C:/My Documents using the GET command.  (Remember the notes on truncating file names when there are spaces!- lcd c:/My*)

 

12.  Congratulations!  You have transferred files, made directories using the command line prompt!!!!!!!

 

 

You can now create folders and move their contents between locations on the local machine and your account on Dante using the command line prompt.  This is a very helpful resource when you need to be able to access and work on documents at a variety of locations but may not have a disk to transport the work.

 

You want to become comfortable in the environment introduced in this lab and the last one.  It will save you headaches in the weeks to come!!!

 

 

 

 

Online Resources:

 

Using Unix                                   http://www.washington.edu/computing/unix/  

 

UW Internet Connectivity Kit Information                                         

http://www.washington.edu/computing/software/uwick/

 

Pine Tutorial                                http://www.washington.edu/pine/tutorial.4/index.html   

 

Starting pine            http://www.washington.edu/computing/email/pinedoc/pstarting.html

 

Using the WWW                           http://www.washington.edu/computing/web/

 

My UW info from C&C          http://www.washington.edu/computing/

 

Creating and publishing web pages  http://www.washington.edu/computing/web/publishing/

 

Using UW Email (3 ways to access): http://www.washington.edu/computing/email/  

 

How-to directions from Catalyst      http://depts.washington.edu/catalyst/how-to/  

 

 

 

 

 

******************************************************

HELPFUL HINTS

 

When you get lost:

As we go through all of this new material it is very easy to get confused and often times to get lost.  When that happens in the command line environment of FTP, the easiest thing to do is go back to your root directory.  From there you can navigate back through your directories to find the place you need to be again.

 

If you get lost, or take a wrong turn as we go through this lab, simply get yourself back to the home directory, the root, of your account with the following step:

·         Type in the shortcut command to change directories to your root.

o        cd  ~your_UWNetID  

 

This command will put you back to your home (root) directory. (see the figure below)

 

 

******************************************************


Common FTP commands:

 

Change to ASCII mode:
ascii

set ascii transfer type. Use this before transferring text files.

 

Change to binary mode:
binary

set binary transfer type. Use this before transferring executable or program files (i.e. image files, compiled code, Word documents, etc.)

 

Disconnect and quit FTP:
1: bye
2: quit

terminate an FTP session and exit.

 

Change remote directory:
cd <path>

change remote working directory. The path can be either relative or absolute.

 

Close a session within FTP:
1: close
2: disconnect

close a connection within FTP.

 

Delete a remote file / files:
1: delete <file>
2: mdelete <files>

delete a remote file or files. Wildcards can be used with mdelete, but are not sugggested for delete.

 

List contents of remote directory / directories:
1: dir [<path>]
2: ls [<path>]
3: mdir [<paths>]

list contents of a remote directory or directories.

 

Get a file / multiple files:
1: get <file>
2: recv <file>
3: mget <files> (used for multiple files)

get a file or multiple files from a remote directory. Wildcards can be used with mget, but are not sugggested for get or recv.

 

Get help:
help [<topic>]

get help. Without a topic, FTP will list the possible help topics.

 

Change local directory:
lcd <path>

change local working directory. The path can be relative or absolute.

 

Create a new directory on the remote machine:
mkdir <path>

make a directory on the remote machine. The path can be relative or absolute.

 

Connect to a new machine:
open <machine name>

Open a new FTP connection. If the machine name is omitted, FTP will prompt for a machine name.

 

Toggle transfer prompts:
prompt

toggles interactive prompting on multiple commands. Specifically, unless turned off, FTP will ask for each file using mget or mput.

 

Send files to a remote machine:
1: put <file>
2: send <file>
3: mput <files> (used for multiple files)

put a file or multiple files from a remote directory. Wildcards can be used with mput, but are not sugggested for put or send.

 

Show the remote machine working directory:
pwd

print working directory on remote machine.  This command will print the directory path to your screen, not to a printer.

 

Remove remote directory:
rmdir <path>

remove a directory on the remote machine. If your directory contains any files, you will not be able to delete it.  This is a nice safety feature, no?

 

Login after failed authorization / change identification:
user [<username>]

send new user information. This is useful for having multiple people send a file using one session or if a password is typed incorrectly upon logging in.