Creating
Directories and Navigating Directory Structures
(or, Where am I, where are my files, and
how do I put my files somewhere else? Part
2)
Create a Directory remotely using Unix
commands
Moving from here to there in one step
Understanding the concepts covered in
Lab 2b:
This part of lab requires you to
work within your Dante file space using a command line environment and the Tera
Term application.
The first part of lab 2 covered
SFTP (secure file transfer), 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.
Lab 2b explores the ways to manipulate and move files
using UNIX commands. You will be
doing similar tasks to Lab 2a, but with a different interface and you will work
completely within your remote account on Dante using Tera Term.
|
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 directories stored in various locations on a remote computer.
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 [the ability of an mechanism to perform the operation for which it was created] is separate from the interface.
Entry point into email, web or file server space on Dante
C. 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.
D. In Lab 2a, you created a folder called Labs 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, list the contents of the current directory in the remote account:
A. Enter ls and hit return
ls is the UNIX command to list the contents of the directory
E. Move into the directory that will hold future lab work. Change
directories and move into FIT100:
cd FIT100
**Notice that this
environment demands your understanding of the Unix
commands. ** These
commands can, among other things: Transfer
folders or files to and
from other areas within your account. See the end
of the lab 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.
Make folders
Move folders
F. Use your ls command again to see the folders that are inside of
your FIT100 folder/directory.
G. Change directories (cd) again to your Labs directory.
cd
Labs
H. Create a directory called Assign_1 in Labs with the following command:
mkdir Assign_1
You’ve created a directory named Assign_1
inside Labs which sits inside of fit100
which sits at the root of your Dante account.
The structure of your folders for FIT100 in your remote account should be:
I. Using the change directory command to move into the Assign_1 directory
A. 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
B. Enter in the following text and then exit and save the file as lab2.txt
C.
Use <Ctrl>x to Exit
D.
Save modified buffer? Yes
E. File Name to write: lab2.txt
This environment doesn’t
recognize spaces.
It is best not to include spaces in your file or folder names.
F. Press Enter or Tab to save
G.
From the command prompts, list the
contents of the folder Assign_l. There
should now be a file called lab2.txt.
H. Go back into the file and edit it. Call the editor and give the file name to open:
pico lab2.txt
To save changes to a file without exiting,
use ^O, which writes the changes to the file.
|
A. Use the cd command to move from your current location in folder Assign_1 to the new location of the Project3 folder.
B.
Look at the Unix command at the
end of this assignment and do the following:
·
Copy the lab2.txt file to your
Project3 folder
· Move lab2.txt from Project3 folder to the Project1 folder
A.
What is Dante?
B.
Use the picture below to answer the question: What single
UNIX command will create the TA_Work directory if you are inside the
root directory?
A.
In the next lab, be able to show
the instructor the full path to your Assign_1 folder. Then use the ls command to show the lab2.txt
inside.
B. Remember to log off the machine as you leave.
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. It will save you headaches in the weeks
to come!!! 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: A.
Type
in the shortcut command to change directories to your root and press
<Enter>: B.
To
move up just one directory at a time, use cd ..
and press <Enter>:
HELPFUL HINTS
cd
[ 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.
cd ~yourUWNetID
Command to go to your root directory
cd ..
Command to move back one level at a time:
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.