Home CPSC 225

Assignment 1: Files and Directories

 

Objective

To gain experience creating files and directories on the Unix command line, and to work with the Vim text editor.

You should have completed weeks one through four before attempting to complete this assignment.


 

Overview

This assignment requires you to have completed weeks one through four of the course. You will follow the instructions below to create and modify a set of files using the tools you learned thus far.


 

Details

  1. Create a directory for this assignment called "assignment1" in your home directory.
  2. Create a file in the "assignment1" directory called "planets.txt" with Vim.
  3. Inside this file, put the names of the planets: Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune and Pluto. Place each one on a line of its own, with no extra spaces or punctuation.
  4. Download this words file into the "assignment1" directory (with the wget command). This file contains over 99,000 English words.
  5. Using Vim substitutions on the "words" file, we will make some changes to English orthography:
    1. Replace all instances of "ph" with "f".
    2. Replace all instances of "ight" with "ite".
    3. Replace all instances of "ll" with "l".
    Each of these changes should be done on lower-case letters only. Don't worry about doing substitutions on upper-case ones. Also, be sure to catch multiple instances on the same line.
  6. Create a directory within the "assignment1" directory called "info".
  7. Create a file within "assignment1/info" called "name.txt", and write your first and last name in this file, on one line. (The grader doesn't check your name, so feel free to use something other than your legal name here).
  8. In the assignment1/info directory, create a symbolic link to "name.txt" called "me.txt".
  9. Create a file within "assignment1/info" called "date.txt", and write the current date in the MM-DD-YY format.
  10. Rename the file "date.txt" file you created to "today.txt".
  11. Create a copy of the entire "assignment1/info" directory at "assignment1/info-backup".
  12. Open up the "planets.txt" file you created in step 2, and delete the line containing Pluto. Poor Pluto :(
  13. Create a file in the assignment1 directory called "stats.txt".
  14. On the first line of "stats.txt", put the number of kilo-bytes the assignment1/info directory takes on disk (using the du command). Do not put the units in the file, just the number.
  15. On the second line, put the number of bytes the file planets.txt file takes on disk (using the ls command). Again, just put the number of bytes without any units.

 

Submitting

To submit, first make sure that you are in the directory where you can see the assignment1 directory, but not inside assignment1 itself:

$ ls
assignment1

Next, create a tarball of your assignment1 repository by running:

tar -czvf assignment1.tar.gz assignment1/

Then turn in the tarball by running:

submit 1 assignment1.tar.gz

This will transfer your submission to the server where it will be graded. It will print your grade to the screen and record your grade. You can submit the assignment as many times as you like. Your best grade will be used.

If you wish to re-submit a new version of your assignment, you will need to run both the tar and submit commands again, since that will make a new archive of your work and send it to be graded.

Copyright © 2024 Ian Finlayson | Licensed under a Creative Commons BY-NC-SA 4.0 License.