Assignment 1: Shell introduction
Due: 5:00pm, Friday, August 29. (Note, though:
Any submissions by 5:00pm, Friday, September 5,
will be accepted without penalty.
This is because other students may enter CSCI 230 late.)
Value: 25 pts.
In this assignment, we will be studying how to use the Linux
command line. It is good to become proficient with the Linux command
line anyway, but later in this course we will be studying how Linux
interprets and executes commands, so it's important that you start
I suggest reading the tutorial
Linux command line, which provides the information about
using the Linux command line necessary to completing this
We will use only Sections 2
through 9 of this document, but of course the remaining sections
are also useful for you to read.
You will need an account on the computer science department's
Linux computers, which can be found in MCRey 316 and 318. This network
is managed independently of the college network, and your password
that works for your e-mail, Campus Web, and the Windows and MacOS
computers around campus will not work with the Linux computers.
If you don't already have a Linux account from a previous semester,
please stop by Dr. Burch's office in MCRey 310. (If Dr. Burch is
unavailable, you might ask Dr. Ferrer if he'd be willing to help.) If
you do have an account but have forgotten your password — shame
on you! But, again, you can stop by Dr. Burch's office for help
with resetting your password.
After you have successfully logged into a Linux computer, you will
want to start the Terminal program. Go to the Application's menu
in the screen's upper left corner, then select the Accessories
submenu, and then select the Terminal option.
What to submit
You should submit your solutions to the below problems as a text file
via the Moodle
course page. If you have completed this assignment with a
partner, please indicate both partners' names at the top of the
file; only one partner should submit a solution.
Please note: When I say a text file, I mean something created
in a genuine text editor that saves simple ASCII (or UTF-8) files.
Do NOT submit a document saved from Microsoft Word or LibreOffice, unless
you have exported it into “Plain Text” format.
Your submitted file should start with your name (and your
partner's) and after that simply have each problem's number followed
by the single command that solves the problem. You do not need
to try to explain why the command works.
Note: Your answers should rely only on the information
provided in the document
Linux command line.
Setting up your file
After logging in, the first thing you will want to do is to fetch
the file that you'll be working with throughout this assignment. To copy
the file into your directory, issue the following command while at
the command prompt: Enter the portion in green
boldface and then press the Enter key.
me@computer:~$ cp /export/shared/courses ~
This copies the file named courses into your home directory.
The courses file lists all CSCI and MATH courses taught at
Hendrix from Fall 2004 to Spring 2011. Here is an example of the first three lines from the file:
2004 1S CSCI150 01 8:10am MTWF 15 MCRey315 D.Collins
2004 1S CSCI151 01 11:10am MTWF 5 MCRey317 C.Burch
2004 1S CSCI250 01 10:10am MWF 3 MCRey317 G.Ferrer
Each line of the file contains
several pieces, separated by tab characters:
- Academic year the course was taught;
for example, 2004 represents the 2004–05 school year.
- Semester it was taught (1S for fall, 2S for spring)
- Course number (e.g., CSCI150)
- Section number (e.g., 01)
- Time taught (e.g., 8:10am)
- Days taught (e.g., MTWF)
- Number of students who earned a grade in the course (e.g., 15)
- Building and room where taught (e.g., MCRey315)
- Instructor (e.g., D.Collins)
No space characters are included on any of the lines — the
only whitespace in the file are the tab characters separating columns
within each line and the newline character at the end of each line.
This assignment consists of a set of
problems for which
you are to write one-line commands that solve the problem concisely.
For each problem, I have provided the output that
would result from executing the correct command using
the provided courses file.
Of course, your solution should represent a
command that actually computes the answer as specified in the
List all lines corresponding to sections taught in rooms that
were not in the Morgan Center (that is, not in MCRey or MCAcx).
2005 1S MATH120 01 9:10am MWF 21 MillsC D.Collins
2008 1S MATH120 01 9:10am MWF 12 Fause10 Z.Barel
2008 2S MATH120 02 11:10am MWF 17 Mills304 J.Nail
Note: Each question includes a sample output, which is actually the
correct answer based on the distributed courses file. Your
solution should include only the information in these lines, though
sometimes the question (like this one) will allow the lines to be
reordered. Don't worry about the number of spaces between columns.
While the questions give the appropriate output for the distributed
courses file, your solution should work as specified even
if courses is changed to add additional courses.
For example, I might get the above output by finding all MATH120 courses
with an enrollment of 12, 17, or 21, but this answer would be wrong with
some changes to the courses file.
List all lines corresponding to sections taught in MCRey115 that were not sections of MATH 140.
2006 2S MATH130 02 12:10pm MTWF 15 MCRey115 Z.Barel
2007 2S MATH130 02 12:10pm MTWF 20 MCRey115 Z.Barel
2008 1S MATH120 02 12:10pm MWF 40 MCRey115 J.Nail
2012 1S MATH270 01 1:10pm MWF 27 MCRey115 C.Camfield
2012 2S MATH120 01 12:10pm MWF 36 MCRey115 D.Collins
For each time CSCI 420 has been taught over the years,
list the year it was taught and the instructor who taught it.
List the year, semester, and instructor for
the seven earliest sections of CSCI 135 (starting from 2004, the
earliest year represented in the file).
2004 2S G.Ferrer
2005 1S G.Ferrer
2006 2S M.Clark
2006 2S G.Ferrer
2007 1S G.Ferrer
2007 2S A.Wright
2007 2S G.Ferrer
Show the lines corresponding to the six sections with the
highest enrollments, in descending order of enrollments.
(Your output may differ from the example output due to
breaking ties differently.)
2006 2S MATH120 01 12:10pm MWF 46 MCAcx119 D.Collins
2012 2S MATH140 02 11:10am MTWF 42 MCRey110 C.Camfield
2009 2S MATH130 02 12:10pm MTWF 42 MCRey110 L.Seme
2008 1S MATH130 02 11:10am MTWF 40 MCRey110 D.Sutherland
2008 1S MATH120 02 12:10pm MWF 40 MCRey115 J.Nail
2007 2S MATH120 01 10:10am MWF 40 MCRey110 J.Nail
List the number of sections of MATH 130 taught in each year.
List the total number of sections of CSCI 150 taught by
each instructor over the years.
List the number of sections taught by each instructor in
the 2009–10 academic year (that is, with 2009 in the
line's first field).
Extra credit: List the number of distinct courses taught by
each instructor over the years listed. By
I mean that somebody may have taught several sections of CSCI 150
(for example), but all these sections together count as just
one distinct course. But if the person teaches CSCI 230 just once,
that also counts as having taught a separate course.