CS 204: Software Design

A Unix Scavenger Hunt

Due on paper at 8:30 AM Friday, January 8. Brief answers are desirable. Provide citations where appropriate.

Feel free to work with your classmates on this assignment.

There are a bunch of questions that start with "What command or combination of commands would you use to...". Where possible, answer these with commands that fit on a single line without semi-colons. If you can't figure out a way to do that, provide a sequence of commands instead.

You may find the following standard Unix commands handy in some of these questions: grep, tr, sed, sort, and find. To read the standard manual pages for these commands, you can type "man grep", "man tr", etc. at a Unix prompt. Of course, Google is always a reasonable option.

  1. If you feel uncomfortable with Unix, walk through this Unix tutorial from the University of Surrey. It may be mostly or all review for you, but I want to make sure we have a common vocabulary of basic Unix ideas. No need to hand anything in for this.

  2. Who wrote the original Unix?

  3. What are "System V" and "BSD"? What, if anything, is their relatioinship?

  4. What are the relationships between MacOS X, NeXTStep, Mach, and BSD?

  5. What is POSIX? What's the relationship between Unix and POSIX?

  6. What is the SCO Group, and what is its relationship to Unix?

  7. How do you think should Unix/UNIX be spelled, and why? (Make sure to find out Dennis Ritchie's opinion on the matter.)

  8. Suppose you want to see the effects of "ls -aF" whenever you execute the "ls" command (that is, you want "ls" to default to using the "-a" and "-F" options). How can you arrange this for your Math/CS account? [This is a question about "aliases" and how they can be created in a suitable "rc" file. If you are using some version of the C-shell, you will need to put your alias command in your .cshrc file. If you are using bash, which is likely if you're using one of our Macs, you will use the .bash_profile or .bashrc file instead.]

  9. If you want your Math/CS account $PATH environment variable to include the current directory (".") whenever you log in, what should you do? [Again, this will lead you to modify your .cshrc, .bash_profile, or .bashrc file.]

  10. What are the advantages and disadvantages of putting "." at the beginning of your $PATH environment variable, versus at the end of $PATH, versus not at all?

  11. What command or combination of commands would you use to remove all the carriage returns (ASCII 13, also known as '\r') from file.txt?

  12. What command or combination of commands would you use to change all linefeeds to CRLF pairs (carriage-return followed by linefeed). Why would you want to?

  13. What command or combination of commands would you use to count the number of blank lines in the file file.txt?

  14. Suppose you wanted to copy the HTML source of the Wikipedia home page to a file called wikipedia.html. Show how you would do it using wget and using curl.

  15. What command or combination of commands would you use to count how many files in your account have names that contain the string "moose", regardless of case. (Thus, if you have smoose.txt and schmOoSe.txt, they should both be counted.)

  16. What command or combination of commands would you use to print the complete list of the "moose" files in your account (see previous question), sorted in reverse alphabetical order?

  17. What command or combination of commands would you use to print all lines containing the word "moose" in all of the files in your account? You may provide a solution that is case sensitive or not, as you wish.