CS155

PmWiki

edit SideBar

Homework 1: Making a file using Unix commands

Homework 1 file should be a plain text file. You should be using redirection (as discussed in lecture) to create and append to the file.

  • Word documents or the like are unacceptable.
  • If you go through and type in the commands from the book and lecture for practice, you’ll finish the homework much faster.

In this assignment you will make a file. Not just any file though; that would be too easy.

You will submit a file named hwk1 which contains the following lines:

  1. The absolute path of your home directory
  2. The contents of the file hw1_file in the pub directory in cs155’s home directory (2 lines)
  3. The output of the program hw1_prog in the pub directory in cs155’s home directory (2 lines)
  4. The command to make a new directory and name it Homework, 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.
  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 spam in the current directory, which contains a list of all the filenames in the hmwk1 directory of the cs155 home directory.
    Note: Write out the command to achieve this—it should take only one command.
  8. The command to copy the file you just made (called spam) to a file named myHW1 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 directory you made in the Homework directory 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 directory in cs155’s home directory to your home directory with a single command. (BONUS QUESTION)

Some Tips

  • Make sure and read the Useful Information section below.
  • Use the man command to get information on commands. For example: man ls

Useful information

  • You will need to be logged in to a Computer Science Department Linux machine in order to do this assignment (e.g., elbert.cs.colostate.edu, lee.cs.colostate.edu, domino.cs.colostate.edu, nelson.cs.colostate.edu).
  • Work alone! You may not work together. You must do this assignment by yourself.
  • The assignment is worth 10 points, and the most you can get is 10.
  • You must answer the questions in order, as your CWD (current working directory) may change from question to question. The bonus point is there so that if you miss a question, you can still get 10.
  • 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 answer to each of the questions, except #2 and #3, must be a single Unix command. This means the command name and its options and arguments.
  • 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.

How to submit your homework:

Go to the same directory as the hwk1 file, and do this:

    ~cs155/bin/checkin HW1 hwk1

How to check your answer before you turn it in:

    more hwk1

How to check your answer after you turn it in:

    ~cs155/bin/peek HW1 hwk1

How to receive negative points:

Turn in someone else’s work.
Edit - History - Print - Recent Changes - Search
Page last modified on December 23, 2008, at 09:52 PM