The purpose of this assignment is to get you set up on the Linux machines for remote development, as the
ability to access and use the lab machines will be critical to you this semester. You will also be setting up the
directories necessary for the semester, using simple Linux commands to solve complex tasks, and getting
familiar with the Linux environment overall.
Details of the assignment
1 Download and preparation
On your local machine, download the ﬁle linux_bootcamp.tar3 from the Assignment 1: LB
folder of the Files tab in the Canvas page for the class. Then use the scp command to copy the ﬁle over
to your account on a lab machine.
For this assignment, you will also need to create a new repository in your GitHub account. Follow the
instructions here. Create a new repository, name it Linux-Bootcamp, and mark it private. Follow the
steps to set up the repository using an existing repository, running the commands in the bootcamp directory.
2 Part A: Remote workspace set-up
Your ﬁrst task is to set up a standard workspace4 structure in your account on the lab machines. Do all of the
following work remotely (i.e., typing commands at the remote prompt while connected to the lab machines
via ssh). You will need to get familiar with basic Linux commands ﬁrst; see Section 8.1.
1. Create the following directories, where each number within the bracket is a separate directory:
2. Set the permission bits on each directory to make sure you can only you can read from and write to
3. Run git init in ˜/cs429/projects/proj1.
4. Run the command ls -lrR ˜/cs429 > ˜/cs429/projects/proj1/partA.txt.
5. Add and commit the ﬁle partA.txt.
3 Part B: I/O redirection problem
By convention, Linux commands read input from the stream stdin (think System.in in Java), write
output to the stream stdout, and write error messages to the stream stderr. However, the Linux envi-
ronment provides two handy mechanism to change these defaults.
I/O redirection: An input redirection (typed as <) makes a command read its input from a speciﬁed
ﬁle rather than from the default stdin. An output redirection (typed as >) makes a command write
its output to a speciﬁed ﬁle rather than to the default stdout. Thus, pwd > output.txt writes
its output of the pwd command into the ﬁle output.txt.
Pipes: A pipe (typed in as | to the remote shell) connects (“pipes”, “redirects”) the output stream of
one command to the input stream of the next command. For example, the command
cat file.txt | grep “hello” lists all instances of the string hello within the ﬁle file.txt.
(You could also do this with the command grep “hello” < file.txt.)
These two mechanisms allow one to chain multiple commands into a larger command, linking together
several simpler Linux commands to solve a complex task.
Move the ﬁle linux_bootcamp.tar in the ˜/cs429/projects/proj1 directory, and then
unpack it using the tar command. Now, using I/O redirection, pipes, and the Linux commands cat,
grep, and wc, ﬁnd the number of times the word INFO (case-sensitive) occurs in the ﬁle log.txt.
1. Put the command in the ﬁle ˜/cs429/projects/proj1/partB.txt.
2. Append the result of running the command to the same ﬁle.
3. Add and commit this ﬁle.
If you want to attempt a trickier example (for fun), try producing a sorted list of the unique ﬁle extensions
in the current directory, with a count of each type, and sorting the extensions by count from highest to lowest.
You will need the commands ls, rev, cut, rev, sort, and uniq.