Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I've been teaching my students the basics of the Unix OS (and Linux) for 4 weeks now. I want to give them a home assignment next. It's the first one so the questions and tasks won't be hard. My only actual goal is to make sure that everyone has access to their own Unix environment, either at school or at home or wherever. I also want to see if they've copied answers from each other. They like copying and sharing.

There will be a sheet for the students to fill in the answers. The first question will be "1. Name, student id". The second one will be something like:

"2. What is the output of the following commands?"

I've been thinking of commands like whoami, who, or maybe who|tail -1 to keep it short, and hostname but all of them have their weaknesses.

Some background: They do not have their own unix user account at school where they use the same username on different workstations. There's no interactive server either. Some students have a bootable flash drive with Linux on it. Some have a Macbook. What most students have is a friend or two who know how to use Unix.

So I'm asking for ideas for the second question. I want to see if the answers are genuine and that everyone's using Unix on their own.

share|improve this question
2  
What qualifies as a "weakness"? Non-portability? Or the ability to be plagiarised easily? –  jasonwryan Sep 15 '14 at 9:08
    
I am not sure tu understand what you meant, however in your case uname -a might be a good command (uniq among all configuration). –  Archemar Sep 15 '14 at 9:16
    
The weakness of whoami: the output the same if you're running Linux on your flash drive so I couldn't tell if it's a copy or a genuine result of entering the command. who isn't very different, or even hostname. –  Miro Lehtonen Sep 15 '14 at 13:42

2 Answers 2

You could make the questions progressive and co-dependent. So you could have:

  1. Run MAGIC=$(uuidgen) and give the output of:

    echo $MAGIC
    
  2. Give the output of:

    MAGIC_NUMBERS=$(printf '%d\n' "0x$(echo $MAGIC | cut -d- -f1)")
    echo $MAGIC_NUMBERS
    
  3. Give the output of:

    echo "$MAGIC_NUMBERS * 3" | bc
    
  4. Fix the following command and give its output:

    bc <<< $MAGIC_NUMBERS - 4 >> $MAGIC && cat $MAGIC
    

You'll obviously need to state somewhere that the questions have to be answered in order and in the same session.

The probability of a duplicate $MAGIC variable from uuidgen is infinitesimal but some of the processing commands I've used here are a bit tough. You might want to write a script that they grab and use to to do part 2 if you do anything with bc.

share|improve this answer
    
Thanks! I'm sure I can use uuidgen if not this time then in later assignments. –  Miro Lehtonen Sep 15 '14 at 16:11

as said in comment

uname -a ; who am i

uname -a gave information about system

Linux mybox 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

who am iw tell the unix user

archemar pts/0        2014-09-15 09:41 (172.16.17.77)

this of course can be copied among your students (.e.g)

 Linux anotherbox 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

by sorting uname -a column, you can have a guess as who is sharing answer (provided you don't have thousands students).

share|improve this answer
    
Thanks! uname with selected options is definitely useful. I'll give those two a try. –  Miro Lehtonen Sep 15 '14 at 16:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.