FIT 100

Lab 2:

Creating Directories and Navigating Directory Structures

in a Command Line Environment

(or, Where am I, where are my files, and

how do I put my files somewhere else? Part 2)

Autumn 2001

 

Introduction:

This lab requires you to work within your Dante account but in a command line environment using a different application - Tera Term.  You will be working outside of class or lab time to complete this assignment.

 

The first lab covered SFTP, creating and moving directories, and understanding where we were at all times when moving and saving files.  The SFTP client you used, SSH Secure Shell, has 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.  Your maneuverability in this environment depends mostly on the keyboard, not on the mouse. 

 

Today’s lab will explore the ways to manipulate and move files using UNIX commands.  You will be doing similar tasks to Lab 1, but with a different interface and you will work completely within your remote account on Dante using Tera Term.

 

What is Tera Term Pro?

Tera Term Pro is a software terminal emulator that supports VT100 emulation, telnet, SSH, kerberos, and serial port connections. It comes with a scripting language and can be used across Ethernet networks or dial-up connections.”  ~UW Computing and Communications

 

Objectives:

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

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

3.      To understand the concept of directory location and its impact on retrieval.

4.      To understand that there are many ways to access remote directories. 

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

 

What we know:

 

TO DO:

 

Create a Directory remotely using Unix commands

One way to move files between directories inside your account on Dante is by using command language.  This is one way to get to the Unix Shell command line interface: 

1.      Find the icon for Tera Term (Dante) on the desktop in front of you.  It is also located in the Start button menu in the lower left. 

 

 

2.      You will log in with your UW Net ID and password

 

Wherever you see homer in these examples, substitute dante

 

 

The menu that comes up next is the entry point into your email or file server space on Dante. 

 

 

Press <S> for the shell.  You are now located in the root (home) directory of your Dante account.  The name of that directory is your UW Net ID

 

 

3.      We want to move into the directory that will hold all our future lab work.  In Lab 1, you created a folder called FIT100LABS inside of a folder called FIT100.  Even though this was done using a different client and interface, you can see those folders here because you are looking into the same file space.

To see if FIT100 is there, and view the contents of your remote account, type in the ls command and hit return:

(**NOTE** The contents of your account will be different from what is shown below.)

You should see dante when working in your account

 

 

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. **

 

These commands can:
Make folders
Move folders

Transfer folders or files to and from other areas within your account.

 

See the below for a basic list of 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. 

 

 
 

 

 

 

 

 

 

 

 

 

 

 

 

 


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**

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 Assign_1 in FIT100Labs with the following command:

·         mkdir Assign_1

 

 

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

-left:.25in;margin-bottom:.0001pt'> 

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

 

 

 

 

 

 

 

 

 

 

 

 

 


·         Using the change directory command to move into the Assign_1 directory

 

5.      The Unix shell has a text editor that you can use (it is just like using Notepad).  Call up the editor by typing pico in the command line




6.     Enter in the following text and then exit and save the file as test.txt

 

 

·         Use <Ctrl>x to Exit

·         Save modified buffer?  Yes

·         File Name to write: test.txt

o        This environment doesn’t recognize spaces.  It is best not to include spaces in your file or folder names. 

·         Press Enter or Tab to save

 

 

7.      From the command prompts, list the contents of the folder Assign_l.  There should now be a file called test.txt

 

To go back into the file to edit it at some later date, simply call the editor and give the file name after it:

pico test.txt

Moving from here to there in one step

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 Assign_1 folder and go into one of our Project folders in one step.

 

Command to go to your root directory:  cd ~yourUWNetID

Command to move back one level at a time:  cd ..



If I want to move from the Assign_1 folder location to the Project3 folder that is sitting inside of FIT100Projects.  I would enter the following:

 

o        cd  ~gbw/FIT100/FIT100Projects/Project3

 

9.      Use the cd command to move from your current location in folder Assign_1 to the new location of the Project3 folder.

 

 

 

 

 

 

 

 

 

 

 

 

 

 


10.  Look at the Unix command at the end of this assignment and do the following:

·         Copy the test.txt file to your Project3 folder

·         Move test.txt from Project3 folder to the Project1 folder

 

Understanding the concepts covered in this assignment:

 

11.  In the next lab, be able to show the instructor thespan>Then use the ls command to show the test.txt inside.

 

12.  Congratulations!  You have made directories and moved files using the command line interface!!!!!!!

 

 

You can now create folders and move content between folders in your account on Dante using the command line.  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!!!

 

 

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

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 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 

 

 

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

 

Common Unix Commands

[ See more commands at: http://www.washington.edu/computing/unix/unixqr.html ]

 

Exit the shell back to the main Tera Term menu:
exit

logout

 

Change directories (folders):
cd path

The path can be either relative or absolute.

 

 

Changing permission status for a file or directory:

chmod   code file
chmod   code directory

 

          To keep a file private:  chmod 600 <file>

            To give everyone read permission:   chmod 644 <file>

 

List contents of directory / directories:
ls

 

Get Manual pages:
man topic

Get the Unix manual pages for a particular topic

man ls  retrieves man page for the ls command

 

Create a new directory on the remote machine:
mkdir  path

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

 

Moving and renaming files:

mv file directory

            Moves a file to a different directory

 

mv   directory1 directory2

Moves a directory to a second directory

 

mv   file1 file2

To rename file1 as file2

 

mv   directory1 directory2

To rename directory1 as directory2:

 

mv -i   file1 file2

To inquire before overwriting an existing file:

 

Remove remote directory:
rmdir path

To 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?

 

Delete a remote file / files:
rm file

 

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.