CS 4950 Spring 2017
Lab 3
Find a computer and log into the
OSX side using your CS login name and password.
Open Firefox and find the class web
page.
Open TextWrangler - use the finder
window and go to applications.
Open a new text file, called Lab3.txt, to record your work today -
you will paste in some of your command lines. The header of the file
should look like:
Your Name
CS 4950
Lab 3
February 17, 2017
Find the Terminal - use the finder
window and go to applications and then utilities.
Make sure you have the
examples from our book:
- In your home directory, you should have created a directory
for CS4950.
- Go to the companion web page for our book: http://practicalcomputing.org/
- Click on "Downloads" and then on "[Examples]"
- Save the downloaded file pcfb_examples.zip in to your CS4950
directory. (You may need to move it from your downloads
directory.)
- Double click on the file and it will unzip and give you a
directory - inside of that directory are the example files that
go with the book.
The first part is to practice with some
basic unix commands. Each command line should be pasted into your
TextWrangler file:
- In the terminal navigate to the directory containing the book
examples. There should be a directory called "sandbox" change
into that directory.
- In the sandbox, make a directory called "test021717"
- Copy all of the files from "examples" to your new
"test021717" and change to the "test021717" directory.
- What happened? Comment
in Lab3.txt.
- List the directory contents and show the path to the
directory.
- Use a wildcard to list all of the files in "test021717" that
end in ".txt"
- Do it again but this time use the redirection operator to
output to a file named text_examples instead of the screen.
How many lines are in shaver_etal.csv? (write your answer in
Lab3.txt)
Open shaver_etal.csv using less
Find the last line with text in it and paste it into Lab3.txt (not
just commas)
Find out how many lines in shaver_etal.csv have Goose lake
and July (this may take several steps and involve
grep)
Go through the example on page 76 of searching across multiple files
with grep.
Try: curl "http://files.rcsb.org/view/1ema.pdb"
Comment on what you see. You may want to go to the url in a browser.
Try: curl
"https://www.wunderground.com/history/airport/KMOD/2000/8/2/DailyHistory.html?req_city=Turlock&req_state=CA&req_statename=California&reqdb.zip=95380&format=1"
Now try: curl
"https://www.wunderground.com/history/airport/KMOD/2000/8/[1-10]/DailyHistory.html?req_city=Turlock&req_state=CA&req_statename=California&reqdb.zip=95380&format=1"
>> turlockweather.txt
Lastly using the example on page 80 create separate files for the
Turlock Weather
How to change your shell to
bash and create .bash_profile
Here is a way that users can change their terminal to bash:
chsh -s
/bin/bash
Then you have to enter your user password and open a new terminal
window to see the changes.
How-to create a bash_profile:
Start up Terminal
Type "cd ~/"
to go to your home folder
Type "touch
.bash_profile" to create your new file.
Edit .bash_profile with nano, pico, or TextWrangler.
Type "source
~/.bash_profile" to reload .bash_profile and update any
functions you add.
Turn it in:
Go to the CS Homework Submission System: https://www.cs.csustan.edu/cshomework/
Choose: instructor Martin
Spring 2017
CS4950
Lab3
Upload the your Lab3.txt file as prompted.