$30
CS246—Assignment 0
This assignment is designed to get you familiar with the most basic aspects of working with
Linux, and with assignment submission. It is not worth any marks, but you must get 100%
on this assignment to get credit for the other assignments.
1. Log into your linux.student.cs account and execute the command ls. You should see a
directory entitled cs246. If you do not see this directory, create it via the command mkdir
cs246.
2. Navigate to your cs246 directory: cd cs246.
3. Verify that you are in your cs246 directory: pwd.
4. Check out the course GIT repository:
git clone ssh://linux.student.cs.uwaterloo.ca/u/cs246/pubrepo/1169/.git
5. Verify that the checkout succeeded: ls. You should see a directory called 1169.
(Parenthetical note: 1169 is Quest-speak for Fall 2016. The last digit is the month, and the
first three digits, added to 1900, give the year.)
6. Navigate to the repository’s assignment 0 directory: cd 1169/a0.
7. Once again, verify that you are in the correct directory: pwd.
8. Using a text editor (either vi or emacs), create the file hello.txt, with contents exactly as
shown below:
Hello from Linux!
I used vi.
If you used Emacs, replace vi above with emacs. You should press enter at the end of the first
line, and at the end of the second line. Once you have created the file, use the wc command
to determine how many lines the file contains. Take note of the relationship between the
number of times you pressed Enter, and the number of lines contained in the file. The exact
result will depend on your editor.
9. Using a text editor (either vi or emacs), open the file ~/.profile (vi ~/.profile or emacs ~/.profile).
This file should not be empty; if it is, check that you have typed the name of the file correctly.
Add the following lines to the end of this file:
source ~cs246/setup
alias g++14="g++-5 -std=c++14"
(Optional) We recommend also adding the following lines to the end of this file:
1
alias vi="vi -X"
export EDITOR=vi
If you choose to use vi, these lines will make vi launch faster, and will ensure that other tools
(like git) default to vi when they launch a text editor. If you choose to use emacs, omit the
first line, and replace vi with emacs in the second line. Save your changes and exit (in vi, hit
Escape and type :wq, followed by Enter; in emacs, Ctrl-X, Ctrl-S, Ctrl-X, Ctrl-C).
10. Using a text editor (either vi or emacs), create the text file path1.txt that contains the answer
to the following question: if your current directory is /u/jdoe/cs246/1169, what relative path
is equivalent to the absolute path /u/jdoe/cs246/1169/lectures/c++/overload? Make
sure, as always, that your file ends with a newline character (whether this implies that you
must press Enter will depend on your editor). Use wc to verify for yourself that your file
consists of exactly one line.
11. Using a text editor (either vi or emacs), create the text file path2.txt that contains the
answer to the following question: if your current directory is /u/jdoe/cs246/1169, what
relative path is equivalent to the absolute path /u/jdoe/cs245/a1? Make sure, as always,
that your file ends with a newline character. Use wc to verify for yourself that your file consists
of exactly one line.
12. Read the manual page for the wc command: man wc.
13. Use wc to count the number of words in your file hello.txt, and use output redirection to
store the result in the file hellowords.txt.
14. Create a text file called promise.txt that contains the following text, all on one line:
I promise not to publicly ask for or provide hints about Marmoset test cases
or assignment solutions on Piazza.
15. Make a zip file containing all of the files in your a0 directory: zip a0.zip * — make sure
you are in your cs246/1169/a0 directory when you do this.
16. Read these documents (on CS 241’s website) about submitting assignments to Marmoset:
http://www.student.cs.uwaterloo.ca/~cs241/w3m
http://www.student.cs.uwaterloo.ca/~cs241/marmoset_submit/
17. Submit the file a0.zip to Marmoset.