Note: Developing any type of application requires a degree of comfort navigating and interacting with your operating system through the command line. We'll practice creating, modifying, and moving files and folders in your terminal to get you familiar with Unix commands.
For your first homework assignment, you're going to create files and folders to organize your favorite books, movies, and music — then, you're going to reorganize them.
Be sure to use the cheatsheets in the "Resources" section if you get stuck.
- Commands you will need to use for this exercise:
- Navigate from folder to folder using
cd. - List files using
ls. - Create new directories using
mkdir. - Create new files using
touch. - Move files using
mv. - Copy files using
cp. - Remove directories using
rmdir. - Remove files/directories that contain items using
rm -rf.
- Navigate from folder to folder using
- Text should be added to files using Sublime or Atom.
- Progress should be tracked by comparing your file/folder structure in your code editor to the images supplied under "Deliverable."
- Submit 2-5 questions you would like addressed regarding this homework.
-
From your root directory, create a folder called
my-favorite-things; you'll use that folder to complete the exercises below. -
Organize your favorite books.
- In the
my-favorite-thingsfolder, create a folder namedbooks, and navigate to that folder. - In the
booksfolder, create a folder named after your favorite author (e.g.,mark-twainorharuki-murakami. Use dashes between words instead of spaces!). - In the author's folder, create files named after some of his or her books (e.g.,
the-wind-up-bird-chronicle.txt). - Navigate back to the
my-favorite-thingsfolder and list the contents in terminal (usingls). - Open the
my-favorite-thingsfolder in Atom or Sublime (Pro tip: You can use thesubl .command in the terminal to open the current directory in Sublime). - In Sublime, edit each file to include a brief description of the book.
- In the
-
Organize your favorite movies.
- In the
my-favorite-thingsfolder, create a folder namedmovies, and navigate to that folder. - In the
moviesfolder, create a folder named after your favorite actor. - Create a text file in the
actorfolder named after his or her breakthrough movie (e.g.,a-woman-is-a-woman.txt). - Look back at Sublime or Atom and edit that text file with a description of the movie.
- Navigate back to the
moviesdirectory. Create a text file named after the actor's character. - Move the text file to the breakthrough movie folder.
- In the
-
Organize your favorite music.
- In the
my-favorite-thingsfolder, create a folder namedmusic. - Navigate to the
musicfolder. - Create a folder named
disco. - Create a text file in
disconamedymca. - Delete the
discofolder. - Create folders named
beatles,beach-boys, andjackson-5(Pro tip: Look up how to create three folders at once). - Create a text file in
beatlesnamedyesterday.txt. - Make two copies of
yesterday.txt. Move one intobeach-boysand one intojackson-5, and rename those files as songs by those artists.
- In the
-
Reorganize everything.
- In the
my-favorite-thingsfolder, create a folder namedmedia. - Move
books,movies, andmusicinto themediafolder.
- In the
-
Look through the additional resources and:
- Look at the top/bottom 10 lines of each file.
- Figure out how to search through a file for a string of text from the command line — without opening the file.
- See if you can figure out how to open a file and add text content in the command line instead of using Sublime or Atom.
No starter code required! Just open up your terminal application to get started.
Be sure you open up your my-favorite-things directory in Sublime or Atom so you can track your progress. Here's how your files/folders should appear after each big step in the exercise:
- After "Organize your favorite books":
- After "Organize your favorite movies":
- After "Organize your favorite music":
- After "Reorganize everything":
- A list of CLI Shortcuts
- An awesome Unix command cheatsheet
- Solve the command line murder mystery!
- Try to complete the Kitchen Organizer lab in as few steps as possible. Look up shortcuts along the way!
- Practice using other popular commands we didn't cover in class by completing the Command Line Fu — Challenge lab.
- Brownie points for configuring your terminal using iTerm. Find some helpful instructions here.
- Practice using these CLI Shortcuts.




