Home CPSC 225

Assignment 1: Files and Directories


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.


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.


  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.
  8. Create a symbolic link to "assignment1/info/name.txt" at "assignment1/info/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.


To submit, first download the submit program:

wget http://ianfinlayson.net/class/cpsc225/assignments/submit

Then set it up to run:

chmod +x submit

Those two commands only need to be done once. If you re-submit, there is no need to repeat them.

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

tar -czvf assignment1.tar.gz assignment1/

Then turn in the tarball by running:

./submit username 1 assignment1.tar.gz

Where username is your UMW netid.

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 only need to run the tar and submit commands again, not the wget command.

Copyright © 2018 Ian Finlayson | Licensed under a Creative Commons Attribution 4.0 International License.