UP | HOME

Homework 2: command line and org-mode

Table of Contents

1 This assignment is due Thurs by 5PM EDT

DEADLINE: 2011-09-22 Thu 17:00

2 Introduction

Homework 1 had you create a CCOM wiki page. Much of the homework for the rest of the class will be in emacs org-mode. You will submit your homework as an emacs org-mode file and an exported HTML file as a tar with the proper file name. Make sure to mark all TODO items as DONE. Make sure to fill in all sections. Mark all check boxes when you complete them.

Put your answers in the appropriate "#+BEGIN_SRC" or "#+VERSE" sections when they are in the homework.

Some questions may start with a "- [ ]". Fill in the line and use C-c C-c to mark the check box as done.

NOTE: You should complete this assignment on your own first. But it is okay to check over each other's completed assignments. I strongly recommend that you have another classmate check your work.

This assignment depends on attention to detail.

3 TODO Download and get started

  • [X] Log in to your virtual machine
  • [X] Open a terminal
  • [X] mkdir -p hw/2
  • [X] cd hw/2
  • [X] wget http://tinyurl.com/hw-2-shell-and-org-mode-dotorg
  • [X] mv hw-2-shell-and-org-mode-dotorg hw-2-shell-and-org-mode.org
  • [X] start emacs and open the homework

Or if you want to do less typing, you can replace the wget and mv command with this:

wget ----output-file=hw-2-shell-and-org-mode.org http://tinyurl.com/3fjdphv 

4 TODO A little org mode intro

This is what inline questions look like. The first question is answered for you and marked as complete.

  • [X] What is the CCOM website? http://ccom.unh.edu
  • [X] What is the website for the operating system we are using in this class inside of the virtual machine?
  • [X] What is the URL for the Wikipedia Entry on Multibeam Sonars?

5 TODO Fill in your name and email at the top

If you don't put your name on your homework, even if sending it to me and naming the files approriately, I will deduct points.

Go to the top of this file and do the following:

  • [X] Replace "FIX: your name" with your name
  • [X] Replace "FIX: your email" with your email address. This must be UNH or NOAA address, or no points.

6 TODO Shell basics

6.1 TODO download the example data

Download this file using wget: http://vislab-ccom.unh.edu/~schwehr/Classes/2011/esci895-researchtools/examples/2007-boston-construction.csv.bz2

Place the command inside the "SRC" and the results inside of the example. I will do the first one for you.

wget http://vislab-ccom.unh.edu/~schwehr/Classes/2011/esci895-researchtools/examples/2007-boston-construction.csv.bz2

Results:

--2011-09-16 03:47:58--  http://vislab-ccom.unh.edu/~schwehr/Classes/2011/esci895-researchtools/examples/2007-boston-construction.csv.bz2
Resolving vislab-ccom.unh.edu... 132.177.103.235
Connecting to vislab-ccom.unh.edu|132.177.103.235|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1030480 (1006K) [application/x-bzip2]
Saving to: `2007-boston-construction.csv.bz2'

100%[========================================================>] 1,030,480   51.4K/s   in 27s     

2011-09-16 03:48:25 (37.9 KB/s) - `2007-boston-construction.csv.bz2' saved [1030480/1030480]

6.2 Uncompress

Use the correct command to uncompress 2007-boston-construction.csv.bz2

# FIX: put command here

6.3 TODO What generally is in this file?

Use the file command to find out what type of file this is.

FIX: put answer here

Results:

FIX: put results here

How many lines are in this file?

# FIX: put command here

Results:

FIX: put results here
  • [X] Read the man page for head

Display the first 5 lines of the file.

# FIX: put command here

Results:

FIX: put results here

Output the last 5 lines of the file. Hint: you can use "man –apropos" to try to find the command to use.

# FIX: put command here

Results:

FIX: put results here

6.4 Bounding box

You can use the "GMT minmax" command from GMT to get the bounding box of this data. What is it?

# FIX: put command here

Results:

FIX: put results here

7 TODO Creating your homework submission

Follow this section very carefully. You should be creating a submission that is layed out exactly as I have done.

7.1 TODO Check your assignment to make sure it is complete

Use the emacs search command for the string "FIX:". The only place where this string should be in your org-mode homework 2 file is in this section. I use that string to mark sections where you need to be replacing it with something.

Searching starts by holding Control and pressing s (written C-s). Then type what you want to search for. In this case, type "FIX:" (without the quotes). To search for the next instance of the string, press C-s again. When you get to the end of the file, press C-s again and it will jump to the top of the document.

7.2 TODO Build the submission    tar bzip2 md5

First create an HTML export of your assignment. In emacs you can type C-c C-e. Remember to hold down the control key and press the letter that follows the dash. You should now see the list of org export formats. Press the letter b and you should see Firefox open up and show you your homework. The full command:

C-c C-e b

Switch back to the terminal. You should be in ~/hw/2. You will now create your submission. Replace YOURNAME with your user name. NOTE: If you don't remember your username, it is what you used to log into researchtools.

First, build the directory tree:

mkdir hw2-YOURNAME
cp hw-2-shell-and-org-mode.org hw2-YOURNAME/hw2-YOURNAME.org
cp hw-2-shell-and-org-mode.html hw2-YOURNAME/hw2-YOURNAME.html

Verify that your homework submission looks correct. It should look something like this:

ls -l hw2-YOURNAME/
total 20
-rw-r--r-- 1 researchtools researchtools 11904 2011-09-16 05:57 hw2-YOURNAME.html
-rw-r--r-- 1 researchtools researchtools  4740 2011-09-16 05:57 hw2-YOURNAME.org

Now we need to create a "tar" archive of your homework:

tar cf hw2-YOURNAME.tar hw2-YOURNAME

Verify the contents of your tar:

tar tfvv hw2-YOURNAME.tar
drwxr-xr-x researchtools/researchtools 0 2011-09-16 05:57 hw2-YOURNAME/
-rw-r--r-- researchtools/researchtools 4740 2011-09-16 05:57 hw2-YOURNAME/hw2-YOURNAME.org
-rw-r--r-- researchtools/researchtools 11904 2011-09-16 05:57 hw2-YOURNAME/hw2-YOURNAME.html

Compress your tar archive using bzip2 with maximum compression

bzip2 -9 hw2-YOURNAME.tar

Compute the md5 checksum.

md5sum hw2-YOURNAME.tar.bz2
57e88b90db260511eee305108d0b2d91  hw2-YOURNAME.tar.bz2

NOTE: You checksum will be different!!!!

57e88b90db260511eee305108d0b2d91  hw2-YOURNAME.tar.bz2

The ">" character redirects the output from the screen to a file. Save that md5 sum to a file. Put the checksum in a file:

md5sum hw2-YOURNAME.tar.bz2 > hw2-YOURNAME.tar.bz2.md5

7.3 Push the files to the researchtools server using scp    scp

Use the secure copy command to copy your files from the virtual machine to the researchtools server

scp hw2-YOURNAME.tar.bz2* YOURNAME@researchtools.ccom.nh:

You will see this the first time that you ssh or scp to a computer from a new computer or account. Each computer has a unique signature that should not change. When you say yes here, the computer will record the host signature. If the host key changes, ssh or scp will warn you loudly about it.

The authenticity of host 'researchtools.ccom.nh (192.168.2.28)' can't be established.
ECDSA key fingerprint is 16:c1:64:32:da:23:b9:58:0a:87:06:5b:05:1a:c5:35.
Are you sure you want to continue connecting (yes/no)? yes

YOURNAME@researchtools.ccom.nh's password: 
hw2-YOURNAME.tar.bz2                                    100% 4705     4.6KB/s   00:00    
hw2-YOURNAME.tar.bz2.md5                                100%   55     0.1KB/s   00:00    

7.4 Setup your researchtools homework area

Use ssh to log into the researchtools server.

ssh YOURNAME@researchtools.ccom.nh
The authenticity of host 'researchtools.ccom.nh (192.168.2.28)' can't be established.
ECDSA key fingerprint is 16:c1:64:32:da:23:b9:58:0a:87:06:5b:05:1a:c5:35.
Are you sure you want to continue connecting (yes/no)? yes

Make sure you are actually logged in to researchtools.

echo $HOSTNAME
researchtools

Setup your homework area, unpack your homework, and move the tar to the "hw" directory.

mkdir hw
cd hw
tar xf ~/hw2-YOURNAME.tar.bz2
mv ../hw22-YOURNAME.tar.bz2 .

Verify that your homework is in place.

ls -la hw2-YOURNAME/
total 28
drwxr-xr-x 2 schwehr domain users  4096 2011-09-16 05:57 .
drwxr-xr-x 3 schwehr domain users  4096 2011-09-20 09:42 ..
-rw-r--r-- 1 schwehr domain users 11904 2011-09-16 05:57 hw2-YOURNAME.html
-rw-r--r-- 1 schwehr domain users  4740 2011-09-16 05:57 hw2-YOURNAME.org

7.5 Tell your instructor that your homework is done

Email me from your UNH email account (no hotmail/gmail/yahoo/etc email) with the subject line "research tools homework 2".

My email address is kurt@ccom.unh.edu

In the email, include the md5 sum of your .tar.bz2 archive. I will then log into researchtools to check on your homework. I will compute the md5 sum of your tar

Author: FIX: your name

Date: FIX: use C-. to put in the date

HTML generated by org-mode 7.4 in emacs 23