Colorado State University

This file defines the header for each page. An optional "icon" image (I use the textbook):

Three headers follow: ! Long name of class !! Semester !!! HW 1, replaced by the name of the current page.

CS155: Introduction to Unix

Spring 2013

HW 1

Links to the various pages for this class:

Wish I could do this: * Schedule

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.
  1. The absolute path of your home directory (it will start with a /).
  2. The contents of the file hw1_file in the pub/hw1Files directory in cs155’s home directory (2 lines)
  3. The output of the program hw1_prog in the pub/hw1Files directory in cs155’s home directory (2 lines)
  4. The command to make a new directory and name it Max, while your CWD (Current Working Directory) is your home directory.
  5. 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.
  6. 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.).
  7. The command to make a file named collection 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.
  8. The command to copy the file you just made (called collection) to a file named my-collection in your home directory without changing your CWD.
  9. The command to go back to your own home directory. (Change your CWD to your home directory)
  10. 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.
  11. 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

% 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.

Page: Main.HW1
Modified: January 28, 2013, at 12:34 PM
Wiki: pmwiki-2.2.35
CS Department
Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2012 Colorado State University