ga-wdi-exercises / to_oz

Navigate the directory tree using the command line. [cli, basics]
0 stars 49 forks source link

CLI HW (Hyojin Sarchet) #246

Closed hyojinsarchet closed 7 years ago

hyojinsarchet commented 7 years ago

[ To Oz? To Oz! ]

  1. mkdir house
  2. cd house, touch dorothy, touch toto
  3. cd homework, mkdir oz
  4. cd oz, touch good_witch_of_the_north, touch wicked_witch_of_the_east, touch good_witch_of_the_south, touch wicked_witch_of_the_west

[ Ding! Dong! The Witch is Dead ]

  1. rm wicked_witch_of_the_east
  2. mv dorothy oz (Question: I am quite sure 'mv dorothy oz ' is the right code. But instead the file name was changed from dorothy to oz.)

[ Follow the Yellow Brick Road ]

  1. touch scarecrow
  2. touch tin_man
  3. touch cowardly_lion
  4. mkdir emerald_city
  5. mv scarecrow emerald_city, mv tin_man emerald_city, mv cowardly_lion emerald_city

[ You Must Kill the Witch ]

  1. cd oz, touch flying_monkeys
  2. rm wicked_witch_of_the_west
  3. echo diploma >> scarecrow echo heart_shaped_watch >> tin_man echo medal >> cowardly_lion ( I am not sure with these answers. I will try to find better answers.)
juancgarcia commented 7 years ago

Good Job!

The mv command is typically used to "move" files, but it can also rename them depending on if the second option is a directory.

In this step dorothy was inside of house: ~/homework/house/dorothy

But oz was outside of house: ~/homework/oz

When you used the command mv dorothy oz from within ~/homework/house, you were telling the terminal: "Move a file in the current directory named dorothy, into a directory also in the current directory, named oz, but if oz is not found, rename dorothy to oz"

In order to make the command perform the move, we need to ensure that the destination is a directory: mv dorothy ../oz

This tells the command to look for oz one directory level above the house folder