Duration: 3 hrs approx.
Creator: Thom Page
Modified by: Kristyn Bryan and Reuben Ayres
Topics: Terminal
A long time ago in a Unix environment far, far away, young Jedi padawans who knew only of desktop software were seduced by the dark side of the Force to enter… The Terminal.
Follow the instructions below using all the console commands introduced in Fundamentals, class, or that you find on your own.
-
Open the Terminal app
-
Make a directory in today's folder called
homework
. Create a new directory in thathomework
directory calledhomework_part_1
and enter it. -
Create a file called
commands.txt
. -
Paste the answer to each numbered question (i.e. the command(s) that accomplished the task) in
commands.txt
once you get it to work.
-
Create a directory called
death_star
, and make the following files inside of it:darth_vader.txt
,princess_leia.txt
,storm_trooper.txt
-
In
galaxy_far_far_away
, make a directory namedtatooine
and create the following files in it:luke.txt
,ben_kenobi.txt
. -
Inside of
tatooine
make a directory calledmillenium_falcon
, and in it create:han_solo.txt
,chewbaca.txt
- You can rename a file using the
mv
command.
- Rename
ben_kenobi.txt
toobi_wan.txt
.
- You can copy a file from one location to another using the
cp
command. (man cp
for more info)
- Directories can be sibling (parrell to each other) or can be parents (the folder that contains the folder you are in)
- Copy
storm_trooper.txt
fromdeath_star
totatooine
.
- You can use the
mv
command to move files from one location to another.mv
can be used for renaming, moving, or both. Runman mv
to see the options—remember hit theQ
key to get out of the manual page viewer.
-
Move
luke.txt
andobi_wan.txt
to themillenium_falcon
. -
Move
millenium_falcon
out oftatooine
and intogalaxy_far_far_away
. -
Move
millenium_falcon
intodeath_star
. -
Move
princess_leia.txt
into themillenium_falcon
.
BE CAREFUL WITH rm
!!! THERE IS NO "TRASH" IN THE UNIX CLI. WHEN YOU DELETE SOMETHING IT IS GONE FOREVER!!!
You can use rm
to delete a file.
- Delete
obi_wan.txt
.
-
In
galaxy_far_far_away
, make a directory calledyavin_4
. -
Move the
millenium_falcon
out of thedeath_star
and intoyavin_4
. -
Make a directory in
yavin_4
calledx_wing
. -
Move
princess_leia.txt
toyavin_4
andluke.txt
tox_wing
. -
Move the
millenium_falcon
andx_wing
out ofyavin_4
and intogalaxy_far_far_away
. -
In
death_star
, create directories fortie_fighter_1
,tie_fighter_2
andtie_fighter_3
. -
Move
darth_vader.txt
intotie_fighter_1
. -
Make a copy of
storm_trooper.txt
in bothtie_fighter_2
andtie_fighter_3
. -
Move all of the
tie_fighters
out of thedeath_star
and intogalaxy_far_far_away
.
BE CAREFUL WITH rm
!!! THERE IS NO TRASH CAN IN THE UNIX CLI. WHEN YOU DELETE SOMETHING IT IS GONE FOREVER
Before you hit enter, make sure are deleting the right thing, or you could accidentally delete the contents of your computer (it has happened).
This command will not typically ask you if you "really want to delete." It will just delete.
- Remove
tie_fighter_2
andtie_fighter_3
.
-
Touch a file in
x_wing
calledthe_force.txt
. -
Destroy the
death_star
and anyone inside of it. -
Return
x_wing
and themillenium_falcon
toyavin_4
.
"Add" your changes (prepare them to be "committed"):
$ git add -A
"Commit" your changes—any time you make a commit, you can always restore the files in the repo to that point:
$ git commit -m "Completed homework assignment"
"Push" your commits to github:
$ git push origin master
Once you've got your homework all done and pushed to github, do a pull request to get it submitted. If you're not sure how to do this, reach out to your instructor for help