IT 244: Introduction to Linux/Unix
Homework 3
Due Sunday, February 11th at 11:59 PM
Deliverables
All this work should be done on users3.cs.umb.edu.
-
A .plan file in your home directory
-
A shell script named hw3.sh that performs the operations listed below.
This file should be in an hw3 directory inside your
hw directory inside your it244 directory.
See this document for instructions on creating this script.
Details
.plan
Go to your home directory and create a text file with the name.plan.
Put some information about yourself in this file.
The text in this file will be printed to the terminal when finger
is run on your Unix ID or name.
Use nano
or any other Unix text editor to create this file.
20 points
The shell script named hw3.sh
Create an hw3 directory in your hw directory
inside your it244 directory.
Go to this hw3 directory.
Run Unix commands that will execute the steps below.
When you have a command line that does what the step asks you to do, copy it from the
command line and paste it into hw3.sh using nano
or any other text editor.
When you have completed all the steps, create an echo statement before the commands for each step,
that will print the step number to the terminal.
Make sure that your script meets all of the requirements mentioned
here.
80 points
-
Print to the terminal the contents of the file red_sox.txt in /home/tsoro/course_files/it244_files
-
Using grep and pipes, | , select all the Red Sox away games where they won, except
for the games they played against the Orioles
Away games are indicated by the @ symbol
-
Select all the Red Sox away games where they won, except
for the games they played against the Orioles, sorted by date in reverse order
-
Print the contents of the file foo.txt in /home/tsoro/course_files/it244_files to the
terminal
-
Print to the terminal the contents of foo.txt,
selecting only those lines with the word "foo" as a whole word
In other words, "foo" must NOT appear as part of another string,
like "foobbbbbbbb".
There is an option for grep
that tells it to only match the string when it
appears as a word, not as part of a bigger string
Check the man
page for grep
to find this option
Don't call the man
page from within your shell script.
-
Print to the terminal the lines in foo.txt that have the string ### in them
-
Print the contents of the file numbers1.txt in /home/tsoro/course_files/it244_files to
the terminal
-
Use head and tail to print to the terminal lines 6 through 13 in numbers1.txt
-
Use sort to print to the terminal the contents of numbers1.txt in reverse numerical order
-
Use diff to print to the terminal the differences between numbers1.txt and numbers2.txt in a human
readable format
-
Print to the terminal the name of the host to which you are connected
-
Consult the
man
page for date, then use this command to print to the terminal the date in the format
yyyy-mm-dd.
Don't call the man
page from within your shell script.
-
Print to the terminal the location of the executable file for
perl
, a scripting language. The command
you use should only work for executable files
-
Find all files that have the string "nano" in their filename
-
List all the users currently logged in to users3
-
Run
finger
on your Unix username to print to the terminal the information you entered
in your .plan file