CS257 Assignment: Unix Miscellany

Due at class time Friday, 4/2/04. Submit on paper. Brief answers are desirable. Provide citations where appropriate.

You may discuss this with classmates, but each of you should hand in your own answers. Don't spoil the experience by giving each other complete answers, but go ahead and offer obscure hints if you feel like it. If somebody's obscure hint leads you to an answer, cite (or blame, if you prefer) the hinter.

There are a bunch of questions that start with "What command or combination of commands would you use to...". Try to answer these with commands that fit on a single line without semi-colons.

You may find the following standard Unix commands handy in some of these questions: grep, tr, sed, sort, and find.

  1. Walk through this 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. Is it spelled UNIX or Unix? On whose authority?

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

  4. What's the relationship between Unix and POSIX?

  5. 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?

  6. If you want your Math/CS account $PATH environment variable to include the current directory (".") whenever you log in, what should you do?

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

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

  9. 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?

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

  11. Suppose you wanted to copy the HTML source of the Google home page to a file called google.html. Show how you would do it using lynx, wget, and curl.

  12. 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.)

  13. What command or combination of commands would you use to print the complete list of the "moose" files in your account, sorted in reverse ASCII order?





Jeff Ondich, Department of Mathematics and Computer Science, Carleton College, Northfield, MN 55057, (507) 646-4364, jondich@carleton.edu