Working with the Unix Shell 1¶
Exercise 0. (20 points)
- Start the Vim tutorial
- Start
emacs
and enterC-h t
to start the tutorial.
When you have completed each tutorial, declare “I have completed the (vi|emacs) tutorial below” for 10 points each.
In [ ]:
Exercise 1. List the folders and files in your home directory, including hidden files. (5 points)
In [ ]:
Exercise 2.1. Create the following empty file:
~/turtle/turtle/turrtle/all_the_way_down.txt
(5 points)
In [ ]:
Exercise 2.2. Using only Unix shell commands, put the following text into the empty file created in Exercise 2.1 (5 points)
One, two,
Buckle my shoe;
Three, four,
Knock at the door;
Five, six,
Pick up sticks;
Seven, eight,
Lay them straight:
Nine, ten,
A big fat hen;
In [ ]:
Exercise 2.3: Append the following lines to the same file. (5 points)
Eleven, twelve,
Dig and delve;
Thirteen, fourteen,
Maids a-courting;
Fifteen, sixteen,
Maids in the kitchen;
Seventeen, eighteen,
Maids in waiting
Nineteen, twenty,
My plate's empty.
In [ ]:
Exercise 2.4. Print ONLY the date and time the file
~/turtle/turtle/turrtle/all_the_way_down.txt
was last modified. (10
points)
In [ ]:
Exercise 2.5. Replace all occurrences of the lower case vowels
“aeiou” in ~/turtle/turtle/turrtle/all_the_way_down.txt
with the
equivalent upper case vowel. (10 points)
In [ ]:
Exercise 2.6. Delete the directory ~/turtle
and all its
sub-directories and files. (5 points)
In [ ]:
Exercise 3. Find all files in the current directory with the word “buckle” (case insensitive) and print their names. (5 points)
In [ ]:
Exercise 4. Download the following file
https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data
into a file
iris.csv'. Create a new file
iris24.csvcontaining just columsn 2 and 4 of
iris.csv`.
(10 points)
In [ ]:
Exercise 5. Using emasc
or vi
(we trust your honesty not to
use any other editor), write a bash shell script that finds the average
of all numbers in a file that has only 1 column of numbers. Using the
script, find the average of the 3rd column of iris.csv
. (20 points)
In [ ]: