|
|
Introduction to UNIX, part II
Other MCSR Seminars
Description
This seminar is a continuation of Introduction to Unix, part
I. Included will be information on the following topics: Working
with files and directories ; Managing your working environment ;
Controlling access to your files and directories ; Sending and
receiving electronic mail ; Editing text files ; Managing jobs
and processes ; Writing shell scripts .
Outline
- Working with files and directories
-
Start the secure shell client:
Start->Programs->SSH Secure Shell->Secure Shell Client
-
Connect to willow:
From the secure shell window, click Quick Connect.
Then, from the Connect to Remote Host pop-up window, enter:
Hostname: willow.olemiss.edu
User Name: student
and click Connect.
- Creating, Editing and
Viewing Files:
Change directories to your numbered directory.
willow> cat
> memo
Press the <Enter> key to start a
new line.
Now type in "remember emacs workshop Feb 9
"
Press the <Enter> key to start a
new line.
Then type, "ask my committee for defense date
." Press the <Enter> key to start a
new line.
Enter Ctrl-d
willow> ls
willow> cat
memo
willow>
echo use an editor for large files > tips
willow> ls
willow> cat
tips
willow> pico
grocery_list
Enter several lines
of text Press the <Enter> key to accept the file name.
Enter Ctrl-O to save (write Out)
the file
Enter Ctrl-X to eXit
the pico editor
willow> ls
willow> cat
grocery_list
Edit the memo file
as follows:
willow> pico
memo
Add a new line of
text:"pick up items from
grocery"
Enter Ctrl-O
to save, the Ctrl-X to exit the
editor.
willow> cat
memo
willow> cat memo tips
grocery_list
willow> ls
../
willow> cat
../goodfile
willow> head
../goodfile
willow> tail
../goodfile
willow> head
-15 ../goodfile
willow> tail
-15 ../goodfile
- Copying
Files
willow> cp memo memo.old
willow> ls
willow> cat
memo
willow> cat
memo.old
willow> cat
memo.old memo
willow> cp
/users/student/goodfile .
willow> ls
willow> cat
goodfile
willow> cp
goodfile badfile
willow> cp grocery_list
grocery_list_old
Copy one of your classmates grocery lists
into your directory. For instance, to copy
student 1's list:
willow> ls
/users/student/1
willow> cp
/users/student/1/grocery_list grocery_list
willow> ls
willow> cat
grocery_list
- Managing your working environment
- Environment Variables:
willow> env (to see the values of your
environment variables)
willow> echo
$HOME (to
print the value of your HOME variable)
willow> echo
HOME (to see
what happens when you leave off $)
willow> pwd (to print working
directory)
willow> cd
$HOME (to
change to your home directory)
willow> echo
$SHELL (to see
which shell you are running)
willow> setenv MYDIR /users/student/<numberwillow> (to create an
environment variable to keep up with your
numbered working directory)
where <numberwillow> is your student number.
e.g., if you are student #1, then
willow> setenv MYDIR /users/student/1
willow> echo $MYDIR to print the value of the
new MYDIR envirnonment variable
willow> pwd to print the current
working directory
willow> cd
$MYDIR
willow>
pwd
willow> echo
$HOME
willow> cd
$HOME
willow>
echo $PATH
willow>
echo $MYDIR
willow>
setenv PATH ${PATH}:${MYDIR}
willow>
echo $PATH
- Environment Initialization Files
willow> ls to list the files in the
current directory
willow> ls
-l to list the
files with long format
willow> ls
-a to list all
files (even hidden dot files)
willow> ls
-al | more to
list all files in long format, one page at a time
willow> cat
.login to view
the environment initialization file that
automatically executes each time you login under
the csh
willow> more
.login to view
the file one page at a time
willow> cat
.cshrc to view the environment
initialization file
willow> more
.cshrc
- Controlling access to your files and
directories
- Practice viewing and
setting the permissions on your files
willow> cd
$MYDIR
willow> pwd
willow> ls -l
Who can read grocery_list?
Who can overwrite/change/modify grocery_list?
What is the group attribute of grocery_list?
What is your current group?
willow> chmod
o-r grocery_list
to remove read permissions for users other than
yourself and those in the group
willow> ls -l
willow> chmod
g-r grocery_list to remove read
permissions for the group
willow> ls -l
- Sending and receiving electronic mail
Demonstrate using pico to send and read email.
- Editing text files
- Managing jobs and processes
- Writing shell scripts
willow> cd $MYDIR
(to change to your student numbered directory)
willow> pwd
willow> pico myscript
Enter the two lines:
ls
ls -l
Then Ctrl-O (to save) and Ctrl-X (to exit)
willow> cat myscript
- For More Information
|