UNIX Exercise Solutions

back to the problems

p1 (ls/cd)

  1. cs107, because of course it was
  2. in two commands: cd ..; cd math19 (in one command: cd ../math19)
  3. .the_actual_triangle_soln.c

p2 (file processing)

  1. wc wordlist.txt yields 88835
  2. grep celeriac wordlist.txt yields yes, grep voluter wordlist.txt yields no

p3 (man)

  1. tree
  2. tree -L 2

p4 (tab autocompletion)

  1. "Did you use tab-complete?", I typed cat z<TAB> to exploit autocomplete

p5 (filesystem manipulation)

  1. touch breakfast/american/bacon.txt (you could also use vim/emacs to create the file)
  2. rm lunch/w2_stanford_2020.pdf
  3. mkdir lunch/american; mv lunch/baked_chicken.txt lunch/american
  4. mv supper dinner
  5. rm -r dinner/american/tax2020
  6. cp lunch/american/baked_chicken.txt dinner/american