Midterm II -- The Best of Unix


  1. Will Smith and David Duchovny are fighting. Who kills more aliens?
    a) Yes, my name is on the test.
    b) Yes, I will definitely put my name on the test.

  2. (3 points) David Duchovny suspects a conspiracy concerning user names and user ID numbers. Write him a Perl or Bash program that reads the password file and prints everyone's name and user ID number (and nothing else). If you get it sorted by uid, that's two extra credit points. Use the back of this paper for space.

  3. On euclid, how many files are in the subtree /etc? ___________________

  4. A Will Smith notices that when he types 'ps aux' he does not see the finger deamon or the fortune deamon, yet clients can connect to his computer over the network and use these services. Besides alien invasion, what else should Will Smith check to explain this behavior?
    _____________________________________________________________________

  5. David Duchovny wants to save a backup of his home directory and all subdirectories every night at 6:00 am. He has plenty of disk space in /backup. He wants the backup to run even if he's not logged in. How can he arrange this? Be specific. If you use any system deamons, give the line(s) you'd add to their configuration files.
    _______________________________________________________________________________________________________________________________________________________________________________________________________________

  6. (2 points) Will Smith wants to delete every file owned by David Duchovny on the system. Write him a Perl or shell script that does this. Use the back of this page for space.

  7. When David Duchovny tries to log in, he notices that he can do so only if the computer is plugged into the network. However, root can always log in. What can you conclude about the computer?
    ___________________________________________________________________

  8. Is 'xterm' a client or a server?
    a) client
    b) server

  9. Suppose these are two lines in the password file. Can there exist a file that is readable by one but not by the other? ___________________
    duchovny:5rhfVf3ogJ.co:1:0:David Duchovny:/root:/bin/bash
    smith:5rhfVf3ogJ.co:2:0:Will Smith:/root:/bin/bash

  10. Do David and Will have the same password? _________________

  11. David Duchovny cannot get X windows to work, even though he has X files. What should he check (list three).
    a) ___________________________________________________________
    b) ___________________________________________________________
    c) ___________________________________________________________

  12. Will Smith has left his home directory world writeable. However, every file in it is world readable but not world writeable. David Duchovny wants to change a his phone number as listed in a file in Will Smith's home directory. Can he? If so, how?
    _______________________________________________________________________________________________________________________________________________________________________________________________________________

  13. (2 points) Every time that Will Smith presses <return> at a bash prompt, he wants the computer to check and see if Duchovny is logged on. If so, he wants to be told so. Change his .bashrc to accomplish this (once more, the back of a page. This is not hard, but requires a clever trick.)

  14. Make David Duchovny an account on your machine. His password should be 'x-files'. His home directory should be /tmp. His shell should be /bin/bash. Show it to me for one point.

  15. Dennis Rodman is an outer space alien. Duchovny wants to make sure that Dennis cannot access his X display. However, anyone else should be able to access his display. Dennis only has access to the computer 'unix.bulls.nba.org'. It's a Mac running Unix. It's Tuesday. How can David Duchovny set up his X Windows so that ANYONE on the internet except Rodman can access his display? Or can he?
    _______________________________________________________________________________________________________________________________________________________________________________________________________________

  16. (2 points) Will Smith wants a program (Perl or Bash) that prints the largest file in a given subtree. It can either print a whole list (in order biggest first) or just the biggest. Write him that program.

  17. Calculus!! What does this expression evaluate to? ___________

    lim x->2 17