Computational Science I - PowerPoint PPT Presentation

1 / 28
About This Presentation
Title:

Computational Science I

Description:

5) Write a paragraph on what your research dreams are (or some such random text) ... 8) Use ls to find out how large foo.txt is ... – PowerPoint PPT presentation

Number of Views:80
Avg rating:3.0/5.0
Slides: 29
Provided by: timwar1
Category:

less

Transcript and Presenter's Notes

Title: Computational Science I


1
Computational Science I
  • Lecture 2
  • CAAM 420, Fall 2004
  • Instructor Tim Warburton

2
Syllabus Part 1
3
Homework due 08/25/04
  • Make sure you can log on to a unix or linux
    system of your choice, which I will refer to as
    nix from now on.
  • (Apply for a ruf account at apply.rice.edu for an
    account if necessary.)
  • Read one of the listed unix quick guides and one
    of the emacs quick guides listed on the next
    page.
  • Download the following file to your home
    directory http//www.math.unm.edu/timwar/CAAM420
    /ExerciseA.tar.gz
  • Uncompress this file using gzip or gunzip
  • Expand the archive with tar
  • Navigate in the directory structure to find the
    following file target.text you may wish to use
    the nix command find as this file is well
    hidden.
  • Open, edit and save this file with emacs to
    change the name in the file to be your name.
  • Use one of the nix mail programs to send only
    the modified file to me.

4
Homework Quick References
  • Unix
  • http//www.rice.edu/it/help/documents/training_doc
    s/index_platform.html
  • http//www.ee.surrey.ac.uk/Teaching/Unix/
  • http//www.unixtools.com/tutorials.html
  • http//www.cs.washington.edu/orgs/acm/tutorials/in
    tro-unix/cheat-sheet.html
  • http//wwwtheor.itep.ru/computing/unix.html
  • http//www.uni.edu/its/us/document/sun/unixref.htm
    l
  • http//www.cs.utk.edu/help/unix/quickref.php
  • http//www.decf.berkeley.edu/help/handouts/unix-in
    tro.pdf
  • Emacs
  • http//www.cs.utah.edu/alee/emacs/emacs_quick.pdf
  • http//seamons.com/emacs/
  • http//rgrjr.dyndns.org/emacs/emacs_cheat.html
  • http//www.cat.pdx.edu/tutors/tutorials/tutorials.
    php?gotoemacs

5
Step 1 starting ssh
  • First bring up a ssh client under windows (this
    allows us to log in to a nix server in a secure
    way)

6
Step 2 choosing the nix server
  • Left mouse click on Quick Connect
  • Next select the server you want to log in to by
    typing in the host name in the pop up
  • Also type in your user name in the 2nd box
    (replace timwar with your own user name)

7
Step 3 successful log in
  • You should see two things
  • 1)
  • 2)

8
Step 4 setting up a profile
  • Click in the box
    and enter in a nickname for this server/user name
    pair (I might use timwarruf). The next time you
    log in from this computer you can click on
    Profiles and just choose the nickname
    (hopefully).

9
Step 5 the text prompt
  • You are now in control of the nix session
  • Anything you type will be taken as a command

10
Rice Unix Cheat Sheet
  • We will discuss the Rice Unix cheat sheet
  • The only way to learn nix commands is to
    practice

11
Step 6 who else is logged in?
  • Q) Are you the only person logged into this
    machine?
  • A) Check by typing who

12
Step 7 shared resource
  • You will see a large number of user names and
    info scrolling past.
  • This tells you that the ruf machine is very much
    a shared resource.
  • In later classes we will start to need a certain
    amount of computational resource demands one
    may wish to find an account elsewhere in a few
    weeks.
  • In the meantime use ruf so we are all on the same
    page.

13
Step 8 viewing all the names
  • The output from the who command whizzed past and
    we could not read it all.
  • A nix feature is we can pipe output from one
    command into a second command.
  • This means instead of being displayed as output
    on the screen, the text is sent as input to a
    different command

14
Step 9 -- piping
  • Following who with (probably shift-\) tells
    nix to pipe the output from who to the nix
    command less

15
Step 10 less is more
  • less is a nix command which takes input from a
    file or a pipe and displays it in an interactive
    way
  • We can navigate through the output using the b
    and spc keys to move up and down.
  • Try it

16
Step 11 Try homework
  • A solution to the first part of the homework

17
Disection of the Homework
  • 1) ls tells us what is the current directory (in
    this case my home directory)

18
2) Using gzip
  • We next invoked gzip with the d argument and the
    ExerciseA.tar.gz file name which decompresses the
    ExerciseA.tar.gz to a new file ExerciseA.tar

19
3) Using tar
  • We next invoked tar to unarchive the tar file.
  • The arguments xf says expand a file.

20
4) Using find
  • We next use find to locate the target.text file.
  • find does a recursive search starting in the
    specified ExerciseA directory.
  • find is looking for target.text
  • When find locates any instance of target.text it
    executes the cp / command.

21
5) Using cp
  • We asked find to invoke a cp command if it found
    target.text
  • Suppose we have a file foo which we want to copy
    to foo1

22
5a) Using cp from find
  • Recall we asked find to execute
  • cp / \
  • This is nix short hand

23
-exec arguments disected
  • cp / \
  • cp is the copy command
  • is a wild card denoting any file find finds
    which matches your description (in this case
    nametarget.text)
  • / is a short hand notation for the users home
    directory.
  • \ says two things
  • \ instructs nix to pass this argument to find
    without doing anything to
  • is the end of command instruction for the exec
    argument

24
Emacs
  • Invoke emacs by typing it at the text prompt

25
Emacs cont
  • So now you can start typing or issuing emacs
    commands

26
Emacs cont
  • We will discuss the Rice emacs cheat sheet here

27
Class Exercise B
  • 1) Make a new directory CAAM420
  • 2) Make a sub-directory CAAM420/ExerciseB
  • 3) Change directory to this new sub-directory
  • 4) Create a file using emacs called foo.txt
  • 5) Write a paragraph on what your research dreams
    are (or some such random text)
  • 6) Save the file
  • 7) Make a copy of the foo.txt file called
    other.txt
  • 8) Use ls to find out how large foo.txt is
  • 9) Use chmod to make it so that all users and
    groups can read this file
  • 10) Ask the person next to your for their user
    name and use cp to copy their other.txt file into
    your ExerciseB directory
  • 11) Use less to read the new other.txt
  • 11) You have just discovered that if permissions
    are set right you can share files on the same
    system but also that your files are visible.

28
Homework
  • Browse through the unix and emacs cheat sheets.
  • We will go through new examples next time.
Write a Comment
User Comments (0)
About PowerShow.com