Quiz

  1. In cases where you make a copy of the whole directory, does using the tab in the shell still completes the filename/next directory for you? I tried that after class but it wasn't completing the filename for me.

    Tab will only complete things that exist, so it can't complete the filename for the yet-to-be-created stuff. But otherwise, tab pretty much always works. Maybe we can talk after class?

  2. Is there a way to safely see/preview what rm will delete before running it? 

    Yes! and that's a good idea. Just use "ls":

    
        ls *.txt
        rm *.txt
    
    

    You can use the up-arrow to replace the "ls" with "rm" to make sure you haven't affected the arguments.

    Another option is to use "rm -i" which asks you about each one, and you respond 'y' or 'n'.

    
    rm -i *.txt
    rm: remove write-protected regular empty file 'harry.txt'? n
    rm: remove write-protected regular empty file 'hermione.txt'? n
    rm: remove write-protected regular empty file 'ron.txt'? n
    
    
  3. How would i save the output of a command to an existing file, without overwriting it?

    I'm not quite sure I understand the question. If the output is going to an existing file, what happens to the current content?

    But maybe you mean the output should *append* to the existing file. You can do that with >>

    
    cs304flask@dix:~/public_html/quizzes$ cat existing 
    This is the current
    contents of the file
    cs304flask@dix:~/public_html/quizzes$ ls *.part >> existing 
    cs304flask@dix:~/public_html/quizzes$ cat existing 
    This is the current
    contents of the file
    quiz01.part
    quiz02.part
    quiz03.part
    quiz04.part
    quiz05.part
    quiz06.part
    quiz07.part
    quiz08.part
    quiz09a.part
    quiz09.part
    cs304flask@dix:~/public_html/quizzes$
    
    
  4. How do you recommend studying this material? What is the most effective study method, considering the ways in which we will be tested? For example, would you recommend flashcards?

    Flashcards are reasonable. But mostly, just practice. Resist the urge to look up or copy/paste commands from some saved source. Just take a few seconds to search your memory before resorting to reference. Pretty soon, it'll become second nature.

  5. What is the difference between single (') and double ('') quotes?

    For most purposes as a beginner, very little. But the shell has *variables*, like this:

    
    cs304flask@dix:~/public_html/quizzes$ x=y
    cs304flask@dix:~/public_html/quizzes$ echo "x is ${x}"
    x is y
    cs304flask@dix:~/public_html/quizzes$ echo 'x is ${x}'
    x is ${x}
    
    

    With double quotes, the substitution is made, but not with single quotes.

    This will not affect your work this semester! But you asked, so I wanted to give an accurate answer.

  6. Are there more lil famous minigame/animation commands like steam locomotive (or whatever sl stands for)?

    I've installed "cowsay":

    
    cowsay moo
     _____
    < moo >
     -----
            \   ^__^
             \  (oo)\_______
                (__)\       )\/\
                    ||----w |
                    ||     ||
    
    
    

    Here's a page about star wars animation using telnet.

    Be careful to read about how to stop the animation; I forgot to and it was very frustrating!

  7. I don't have any questions about this material at this moment. / Nothing! ...

    Great!