COMP 3000 2012 Midterm Material

From Soma-notes
Revision as of 17:48, 22 October 2012 by Sdp (talk | contribs) (added questions from lab 1)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Questions from Lab 1

  1. What is your username on this wiki? Have a TA help you create an account.
  2. What Linux distribution are you using? What version? You should look at the file /etc/issue generally to find out.
  3. What shell do you get by default when you log in? Check by running echo $SHELL. If it is not bash, then type exec bash to switch to it.
  4. Is your Linux environment running virtualized or on bare metal? How do you know? (If you aren't sure, say so, but explain why.)
  5. Who installed and configured your Linux environment? What level of access do you have to it?
  6. A shell command can be one of four things. What are those four things? Explain very briefly.
  7. On the machine you are on, in what directories are commands external to the shell stored? How can you get this information on the command line?
  8. Compare the commands ls /usr/bin | more and ls /usr/bin | less. How is the output similar? How are they different?
  9. How would you create an empty file with the filename empty file.txt? (Yes, that is a space in the filename.)
  10. How would you output the contents of this file?
  11. Some shell commands, such as pwd, are both built-in and are external. What is one reason why both versions might be present?
  12. What are the permissions on your Linux home directory? With those permissions and your knowledge of the other accounts on the system, who has access to your home directory, and what sort of access do they have?
  13. Give one or more command line strings that use the following operators: >, <, >>, <<, |. Explain briefly what each operator is doing in your examples, both concretely and in terms of STDIN and STDOUT.
  14. Are there operators that work specifically with STDERR? Explain briefly.
  15. How do you use these operators with other file descriptors? Explain briefly.
  16. Give an example of a bash for loop and explain what it does.
  17. Give an example of a bash if statement and explain what it does.
  18. With the & you can put processes in the "background". Given that external commands are always run as separate processes from the command shell, what is the key difference between foreground and background processes?
  19. What are the differences between shell and environment variables? Specifically, what processes have each of them, and to what extent are they shared? HINT: look at the execve system call.