Due: Thursday, April 7, 2022, at 11 pm (you really don't want to burn up late days on this one!).
The purpose of this assignment is for you to become familiar with the
basics of the Linux shell and the range of commands that are included in
most Linux distributions. This very definitely does not include all of
the commands you will need for this course. Instead, it is aimed to help
you learn about some basic commands as well as how to discover more on
your own. You should use the Linux Pocket Guide and the Linux
man
command or the online version of the Linux man pages
(see the link on the course web site) to find specific commands needed
to answer these questions, and use the Pocket Guide to read about
related commands and topics. Google is also useful for locating things,
but you need to learn your way around the Guide and the standard Linux
documentation, which is the primary source.
Be aware that search results from Google or other online resources like
StackOverflow can be right on target or completely misleading or somewhere
in between, so use them mostly to discover possible solutions that you will
want to investigate further using the actual documentation.
There are two parts of the assignment. In Part I you are asked to run several commands and capture the terminal session in a script file to hand in. Part II consists of several questions to be answered in a separate file. You should turn in both files when you are done.
Use the command script hw1.part1
to start a shell and
save the input and output into a file hw1.part1
. Then run
the commands needed to answer the following questions. If you make a few
small mistakes you don't need to start over, but include comments (input
lines starting with #
) after non-trivial goofs so we can follow your
output easily. Also don't worry about "invisible" control
characters like tabs and backspaces that are captured in the script
file. That is normal and not something that needs to be fixed.
Suggestion: do a practice run to find answers to these questions first,
then once you have discovered answers, create the script file with,
hopefully, a minimal amount of fumbling. But some fumbling and goofs
are expected and are fine as long as you include #
comments to help the reader if something is particularly confusing.
It would also be helpful if you included general comments to identify answers to the different sets of questions to make it easier for the graders to navigate through the output.
temp
. files
. files
folder. now
now
to a file
called before
secret
containing the string xyzzy
without using a text editor. (There are at
least three easy ways to do this.)secret
to magic
files
folder with a single command. (The command
you use should also delete all of the files inside of the folder.)secretfile
containing the text It's
a secret!
using
the echo
command. ls
command to show the file
name and permissions.secretfile
using the
cat
command.ls
command again to show the file name and permissions.cat
.Use a text editor (emacs suggested - you should learn how to use it at some
point, even if you later use something else - although it ok to use vim instead if you insist,
and if you are using VSCode that's also ok) to create a plain text file named hw1.part2
containing
answers to the following questions:
wc
does. Give a brief description of
it here. What does the -l
option for wc
do?wc
on the file /etc/passwd
and copy and paste your findings.$HOME
store? (Hint: use echo $HOME
to investigate.)bigredbutton
somewhere on your computer and couldn't
remember what folder it was in, what command could you use to find it? Just
give the name of the command. You do not need to describe all of the necessary
arguments.which
command?echo Hello World! > something
differ
from echo Hello World!
? echo
command from the previous question and now
we execute echo more text > something
.
Describe what this does.echo yet more text >> something
.
Describe what this does.Assessment: Your solutions will be evaluated on how well they follow the instructions and produce the desired results in part I, and on the correctness and conciseness of your answers in part II. Note: Remember that we will check your solutions using CSE's Rocky Linux system. Be sure that your answers are valid on the CSE systems (either cancun or the CSE home virtual machine). Some answers might be different depending on which of those systems you are using, which is expected, but your answers must be from one of those two systems.
Reminder:
the script
command captures everything,
including backspaces and other corrections as you are typing input.
It's fine if there is some of this in the submitted file, but if
there is too much clutter or too many mistakes, it would be best to
start over and get a reasonably clean hw1.part1
file
to turn in.
Turn-in Instructions: Use gradescope, linked on the
course resources web page, to turn in the hw1.part1
file created in
in part 1 and the hw1.part2
file from part 2.
Gradescope will allow you to turn in your homework up to
two days late, if you choose to use one or two of your late days, but
you are strongly advised to save your late days
for much later in the quarter when you may really want them.
If you create the files on cancun
,
you can use scp
(winscp
on windows)
to transfer the file to your local
machine so it can be submitted using your local web browser.
If you are using the UW CSE Linux virtual machine,
use the "file cabinet" (files) program on the VM to open a window
showing the the directory (directories) containing the file(s).
Then use a web browser on the VM, probably Firefox,
to upload the files to gradescope.