CS155 HW1: Making a file using Unix commands
Summary
In this assignment you will make a file called hw1
(that’s h-w-one, not h-w-ell). Note that the name is small letters,
also known as lower case.
You will create a plain text file. You will use redirection (>
and >>), as discussed in lecture, to create and append to the file.
You will submit this file, hw1, as your homework.
- Items 1–3
-
Do the command, and tell me what the output is.
- Items 4–11
-
Do the command, and tell me what the command is.
I do not want the output of the command—I want the command itself.
- The absolute path of your home directory (it will start with a
/).
- The contents of the file
hw1_file in the pub/hw1Files directory
in cs155’s home directory (2 lines)
- The output of the program
hw1_prog in the pub/hw1Files directory
in cs155’s home directory (2 lines)
- The command to make a new directory and name it
Max,
while your CWD (Current Working Directory) is your home directory.
- The command to list the contents of the directory you just made,
while your CWD is your home directory.
Note: the file that you turn in should not contain a list
of files—it should contain the command.
- The command to change your CWD to the directory you created above
(be sure to change into that directory to finish the rest of this assignment.).
- The command to make a file named
bunch in the current directory,
which contains a list of all the filenames in the bin
directory of the cs155 home directory.
Note: Write out the command to achieve this—it should take only one command.
Another note: it is not acceptable to simply look at the directory,
and then create an echo command that echoes what you saw.
Your command must work, no matter what the contents of the bin
directory might be.
- The command to copy the file you just made (called
bunch) to a file
named my-bunch in your home directory without changing your CWD.
- The command to go back to your own home directory.
(Change your CWD to your home directory)
- The command to delete the
Max directory, that you created,
including any and all files inside the directory,
while your CWD is your home directory.
- The command to copy all of the files in the
pub/hw1Files
directory in cs155’s home directory to your home directory
with a single command.
Useful information
- Use the
man command to get information on commands.
For example: man ls
- Remember, use quotes when you use
echo,
echo "cat *.html"
or things like * or ~ will get expanded.
- Word documents and the like are unacceptable.
- You will need to be logged in to a
Computer Science Department Linux machine
in order to do this assignment
(e.g., corn.cs.colostate.edu, potato.cs.colostate.edu, etc.)
- Work alone! You may not work together.
You must do this assignment by yourself.
- The assignment is worth 5 points, and the most you can get is 5.
It’s half a point per question, with one extra question
in case you get one wrong.
- You must answer the questions in order, as your CWD
(current working directory) may change from question to question.
- Don’t put any extra lines in the file, just the ones listed above.
- Do not number or format your answers. Simply answer each
question; those answers should be the only lines in the file.
- Do not add extra spacing between answers.
- Your final file should have exactly and only 13 lines
- The answers to 4–11 must each be a single Unix command.
Semicolons and pipes are not allowed.
- Each question assumes you have correctly done the previous steps.
For example, question 3 assumes you have done 1 and 2.
- Some of the questions may have more than one correct answer.
- UPPER-case and lower-case are different. If I ask you to create
something called “Bob”, that’s different than “bob”.
- When using
echo to append to your file, make sure to use "quotes".
Consider the following; If I see answers like the file bad, then I
think that you don’t know how to use ~.
% echo cd ~ >bad
% echo "cd ~" >good
% cat bad
cd /s/parsons/d/fac/applin
% cat good
cd ~
How to submit your homework:
Follow the directions on the homework page.
How to receive negative points:
Turn in someone else’s work.