------------------------------ Question (1 point) ------------------------------ ls -l shows the size of a regular file in bytes: % ls -l /etc/passwd -r--r--r-- 1 root wheel 228230 Aug 28 11:28 /etc/passwd What ls option(s) are needed to produce output like the following instead? -r--r--r-- 1 root wheel 223K Aug 28 11:28 /etc/passwd Answer: ------------------------------ Question (1 point) ------------------------------ Last semester I saw a lot of 372 students type "cd ~". What's silly about that? Answer: ------------------------------ Question (1 point) ------------------------------ If your current working directory is / and you do cd ../.., where do you end up? Answer: ------------------------------ Question (1 point) ------------------------------ Imagine that for some reason it has been decreed that support is to be removed from Linux for either absolute or relative paths. A worldwide vote will determine which is removed. Which would you vote to *KEEP*, and why? Answer: ------------------------------ Question (1 point) ------------------------------ Here's what ls shows for a directory that contains only a file whose name is three blanks. % ls -l total 0 -rw-rw-r-- 1 stdntwm stdntwm 0 Sep 8 02:27 What can the user do to see the name of that file? Hint: Your first step needs to be making a file whose name is three blanks. Answer: ------------------------------ Question (1 point) ------------------------------ Can there be more than one absolute path to a particular file, like /etc/passwd? If so, show an example. Answer: ------------------------------ Question (1 point) ------------------------------ Tricky question: One "dictionary" is in /usr/share/dict/words. What directory do I need to be in for 'wc -l dict/words' to tell me how many words are in /usr/share/dict/words? Answer: ------------------------------ Question (1 point) ------------------------------ After typing "man bash" exactly what would you type to search for the string PROMPTING? Answer: ------------------------------ Question (1 point) ------------------------------ Run "a3/mystery /bin/date | less" and page all the way through it. (SPACE to advance; q to quit.) What do you think the mystery program is showing you? Answer: ------------------------------ Question (1 point) ------------------------------ A friend claims that "touch file" and "cat /dev/null > file" are equivalent. Devise and show an experiment that either proves they're equivalent or not equivalent. Answer: ------------------------------ Question (2 points) ------------------------------ Does Java do tilde expansion? I'm not looking for a simple yes/no. Instead, show your work! Write a Java program that tests the question. Show interaction with the shell where you cat it, compile it, and run it. (See slide 51 for an example of proving/disproving a question like this.) Answer: ------------------------------ Question (2 points) ------------------------------ Add this alias to your .bashrc and do "restart". alias sayhello="echo hello" First, confirm that sayhello works. Now edit your .bashrc and delete that line. Do "restart". If you try sayhello now, you'll see that it still works. Next, try logging out and back in. Confirm that sayhello now doesn't work. Why did sayhello remain after a restart but not after logging out and back in? Answer: