Practice Cmds 1

Using the files under dirtree from the tar file downloaded (and best if you do it after competing Practice Paths 2), answer the following questions. Also describe the techniques and commands you used to determine the answers (so each questions has 2 answers):
  1. What file(s) tell you about water?

  2. What file(s) tell you about colors?

  3. What is Cathy's favorite color?

  4. What file(s) tell you about your CMU-Africa?

  5. How many different colors are mentioned in the files?

  6. How many types of water are mentioned in the files?

  7. Show the lines from all the files under dirtree/sdirb/ssdir3/sbdir3/sbd3/ that have a c.

  8. How many files under the dirtree directory have a capital letter in their name?

  9. How many files in the dirtree/sdirb/ssdir4/sbdir4/sbd4/ directory contain a capital letter?

  10. What files in dirtree/sdirb/ssdir3/sbdir3/sbd3/ contain an f or an F. Give the command to run from the dirtree directory (in other words, cd to dirtree and run it from there).

  11. How many files are in / (the root directory)?

  12. What are the regular files (i.e. not directories) under dirtree?

  13. How many directories are under dirtree?

  14. What does this command give you (explain in English too):
  15. ls -R dirtree | grep -v : | sort -u

  16. Super tricky ... try it. What is does this command do? Note: it is on one line, even if HTML is formatting it on two.
  17. ls -R dirtree | sed -e 's/.*\///g' -e 's/://' | sort -u


Hint: For the complicated ones, try each part separately first. So do the first part, up to the pipe. Then add up to the next pipe, ...