Session 1 Success at Turing, Files, Directories, Paths, Terminal

Goals

By the end of this session, you will be able to:

  • plan and build a calendar that leads to successful outcomes
  • refine searching and filtering skills to Google programming questions
  • notate file paths from diagrams
  • navigate through directories from the command line
  • make and remove files and directories from the command line

Agenda

  • Intro + Housekeeping
  • Success @ Turing
  • Files, Directories + Paths
  • Terminal + Command Line
  • Googling
  • Closing + Homework Preview

Materials

  • Quiet Space
  • Notebook
  • Writing instrument
  • Laptop
  • Headphones & mic

Introductions

  • Instructor intros
  • Follow along by clicking the lesson plan in slack

Housekeeping and Follow-ups

  • Change display name in Zoom by clicking the Participants menu and choosing Rename. Make sure to match the following format:
    • Color Status 🟢 🟡 🟠 🔴
      • To open the Emoji menu on Mac, click in any text field and press CONTROL + COMMAND + SPACE
      • Search for Green, Yellow, Orange, or Red to pick the appropriate color based on your current status
    • First name
    • Last initial
    • Pronouns
    • Program (FE or BE)
    • Example: 🟡 Kaitlyn V (she/her, FE)
  • Sessions will be recorded and posted in Slack
  • No computer yet? Don’t fret for today. If you don’t have a mac, please reach out to me! (Kaitlyn Van Gorkom or @kvg)

Other things to note as we go through Mod 0:

  • Zoom: turn video on, turn mic off unless speaking
  • You can raise your hand using zoom: go ahead and try it now!
  • Problems or individual questions during the Zoom session? Send a message in the chat!

Breakout Rooms

This is a feature in zoom that we’ll use throughout the mod 0 sessions. They allow for small group discussion, where y’all can solidify concepts or work through challenges. You’ll be kicked out into smaller group with 2 or 3 of your classmates. When they’re finished you’ll get a 30 second warning where you can rejoin the main session, or you’ll automatically rejoin at the end of the 30 seconds. During these, we may broadcast messages or pop in to see how we are doing time-wise.

Some norms before heading in:

  • Be aware and try not talk over others.
  • Leave space and time for everyone to share.

Breakout groups can be a bit awkward at first, but try to embrace them and have fun!

Try It: Break out rooms

1. Introduce yourself (name, pronouns, program)

2. Where do you call home?

3. Why Turing?

Time Management at Turing

As you may have heard, the time commitment at Turing is no joke. In case you HAVEN’T heard, let’s just get it out in the open: many students work harder at Turing than they have ever worked before. Remember, this is an accelerated program - you are going to learn the technical and professional skills needed to succeed in demanding, yet high-paying technical careers in only 7ish months!

Most students estimate they work an average of 60-70 hours per week at Turing- some weeks with fewer hours, some weeks with more hours. While at Turing, time is your most valuable commodity- how you use your time will go a long way in determining your overall success in the program! And ask any student: time has a way of escaping you at Turing unless you are able to manage it successfully.

One strategy we’ve seen our most successful students employ is using some type of calendar system to track, manage and plan their time while in the program. A few key notes:

  • Calendaring is a very difficult skill to master - you will need to commit to practicing it in order to improve!
  • Find a calendar tool and stick with it - Everyone’s system, calendar tool, etc. might be a little different, but those who DON’T use any tool typically struggle with time management while at Turing. We STRONGLY RECOMMEND you use Google Calendars because a) we use that at Turing and b) it is a very popular tool in the field so it is good to practice using it now!
  • Calendars are meant to be living documents that can change - Unfortunately you can’t plan for everything. Being able to make adjustments to calendars as things change is a very important skill to start practicing

Calendar Analysis - Small Groups

In small groups, take a look at the following calendar examples.

Be sure to discuss the following AND jot down your own observations in your notebooks.

  • What stands out about this calendar?
  • Are there any potential issues with this calendar?
  • Are there any aspects of this calendar you would want to include on your own?

After discussing in groups, we will share out observations as a whole!

Time MGMT + Calendar Tips from Successful Students

  • Purposefully build in scheduled time for health, wellness and whatever else you need to be your best self If you don’t plan for it - chances are it won’t happen. Turing moves fast, but it is still a marathon. How can you make sure you are creating a sustainable schedule/routine?
  • Break down time blocks as much as possible - anything over an hour will usually be unproductive and give too much time to procrastinate
  • Avoid context shifting too frequently - on the flip side, don’t break down your blocks too much! For example, trying to cram 4-5 different tasks into a single hour is also not productive and can be extremely exhausting
  • Treat your blocks of time as appointments that shouldn’t be missed - You woudln’t miss an appointment with a mentor, treat your other blocks the same way - even for solo work time!
  • When you think of something you need to do, put it on your calendar immediately - For example, if after a particular lesson, I think to myself “I really want to go back and finish that You Do we started in the lesson…” I will immediately pull up my calendar, find a 20ish min block of time in the next couple of days and make an event for working on that particular exercise (and add the link to the lesson and/or exercise to that event)
  • Reflect on your time management each week - Build in time each week to reflect on how well you stuck to your schedule. Be gracious to yourself and adjust the upcoming week
  • Time MGMT becomes more important throughout the program - As the program progresses you will find yourself balancing more responsibilities, such as attacking the technical curriculum while simultaneously searching for your first software developer job!

Files, Directories, and Paths

On your computer, you probably have many files and directories. Files are things like text documents, images, videos, PDFs, etc. Directories (or folders) are the structures we use to organize these files.

In the diagram below, we would say that there’s a directory called essays that contains three files: life_lessons.docx, book_report.docx, and literary_analysis.docx:


Example #1

files and directories 1
A file path is a way to notate where a file "lives" on your computer. This is the structure:
directory_name/file_name.extension
The file path for the first file in the diagram would be:
essays/life_lessons.docx

What is the path for book_report.docx?

What is the path for literary_analysis.docx?

Things to Note

  1. A file cannot be inside of another file. This means that every part of the path before the actual file is a directory.
  2. For now, we will follow two convention rules:
    • Use lower case letters when naming directories and files
    • Use underscores (_) or hyphens (-) instead of spaces when naming directories and files. However, keep in mind that different languages and frameworks have different conventions. Rather than arguing over which approach is "correct" (you'll find a lot of this on the internet), it is more important to pick an approach and be consistent. For today's lesson, we'll use the underscore (_) approach.
  3. Folders do not have extensions (like .docx or .md or .csv, etc.) but file names do have extensions.
  4. File extensions matter. A .md file will behave differently than a .docx file, which will also behave differently than a .md file because the extensions help the operating system figure out which application can open the file.

Example #2

files and directories 2

The path for the grading.md file is

to_do/work/grading.md

What is the path for cleaning.txt?

What is the path for recurring.txt?

What is the path for grading.txt?

What is the path for data_entry.csv?

Things to Note

  1. We commonly refer to directories with an analogy of parent and child. In the above example to_do is the parent directory of the home and work directories. projects_to_delegate is a child directory of the work directory.

Terminal and Command Line

The terminal is what we call a command line interface. Basically, that’s a fancy way of saying that it’s the program we use to give commands to the computer.

We use the command line because it is a faster and more precise way to navigate our file systems, and certain tools can only be downloaded and accessed via the command line.

Your terminal will look something like this:

Apple recently changed its default profile to .zsh. We will be using zsh in Mod-0 and beyond. Another shell you may hear about is called bash. These shells mostly behave the same. You will learn how to start customizing your zsh shell as part of your HW!

Some follow up reading that is Not Required: Apple Switches from .bash to .zsh - who cares and what does that even mean?

Commands

Let’s put your Googlin’ skills to the test! In breakout rooms, research the following commands and come up with your own definition for what they do. We will share out what each command does and model how to use them as a whole group!

Action Commands

  • mkdir
  • cd
  • cd ..
  • touch
  • clear

Safe/Informative Commands

  • pwd
  • ls

Destructive Commands

  • rm
  • rm -rf

In this section on command prompts, we’ll learn (or review) the commands below. We’ll look at all 10 together (take notes!), then you’ll go into breakout rooms to practice them.

Action Commands
Safe/Informative Commands
Destructive Commands

1. Where am I? (pwd)

When you open the terminal, you will be in your home directory. Being in various directories will allow you to do different things, just like you can do different things at home vs. on vacation vs. at work.

To figure out where you are in your computer’s directories, type pwd after the command prompt. pwd stands for “print working directory”

timo@Tims-MacBook-Pro:~$ pwd
/Users/timo

You’ll see the path from the root of your computer to your current directory.

2. Make a Directory (mkdir)

To make a folder using the visual interface of Finder, this is what you might do:

making a folder using finder

We can make new directories with the mkdir command. Unlike pwd where we didn’t need to type anything else, we’ll need to add a name for the directory. Keep your directories lowercase with no spaces. If you need to use a space, use the underscore (_).

For example, the following two commands will create two directories called work_spreadsheets and latest_projects:

timo@Tims-MacBook-Pro:~$ mkdir work_spreadsheets
timo@Tims-MacBook-Pro:~$ mkdir latest_projects

You won’t get any confirmation that your directory was created – you’ll just see a new command prompt ready for your next comamnd.

3. Listing Contents of a Directory (ls)

With a visual interface (as shown in the gif above), you can easily see the contents of a directory. On the command line, it’s a little different.

To check what’s inside of a directory, we use the ls command which stands for list (although I like to think to myself: “list stuff”). As an example, let’s assume that I have the directories and files from this diagram on my computer:

files and directories 2
If I was in the essays directory and I typed ls, this is what I'd see:
timo@Tims-MacBook-Pro:~/essays$ ls
  book_projects    life_lessons.docx    notes.docx

You will only see the directories and files that are directly inside of where you are. You will not see any directories or files that are nested down the path. This is why we do not see the contents of book_projects listed.

Now assume we're in the book_projects directory. If I type ls, I'll see this:

timo@Tims-MacBook-Pro:~/essays/book_projects$ ls
  literary_analysis.docx    book_report.docx

4. Go Into a Directory (cd)

You can move into a directory using the cd command, which stands for “change directory”. After cd, type the name of the directory you want to go into.

files and directories 2
For example, if I was in the essays directory and wanted to move into the book_projects directory to see my documents, I would type this:
timo@Tims-MacBook-Pro:~/essays$ cd book_projects
timo@Tims-MacBook-Pro:~/essays/book_projects$
We see that the second command prompt now lists the path of new directory that we're in. From there, if I used the ls command, I would be able to see the contents of my folder:
timo@Tims-MacBook-Pro:~/essays/book_projects$ ls
literary_analysis.docx    book_report.docx

Things to Note

  1. You can't pick any random directory from your computer to give to the cd command. It has to be a directory inside wherever you currently are (or you need to use the full path to get to that directory, which we won't talk about today).

5. Get Out of a Directory (cd ..)

To get out of a directory you’re in, we use cd .. (with a space between the d and the first dot). This means “go back up one level.”

If I’m in the book_projects directory and I want to get back to essays, this is what I’d type:

timo@Tims-MacBook-Pro:~/essays/book_projects$ cd ..
timo@Tims-MacBook-Pro:~/essays$

Notice that my path no longer includes book_projects because I’m outside of that folder now.

Note You never want to cd into a directory above your home directory. This area requires admin permissions, and there is no practical use case for being there.

Try It: cd and cd ..

Let's try to figure out the following scenarios together.

files and directories 2

If I'm in the work directory, what do I need to type to get to to_do?

If I'm in the projects_to_delegate directory, what two commands do I need to type to get to to_do?

(We'll learn how to combine these momentarily)

I'm in the home directory. What three commands do I need to type to get to projects_to_delegate?

(We'll learn how to combine these momentarily)

I'm in the projects_to_delegate directory. What three commands do I need to type to get to home?

(We'll learn how to combine these momentarily)

Things to Note

  • One can combine commands to navigate multiple levels through your directory structure.
  • For the third example in the previous Try It section, one could navigate to the projects_to_delegate directory as long as one knows the path:
  • cd ../work/projects_to_delegate
  • For the fourth and final example above:
  • cd ../../home
  • Each level in the path is spearated by a /

6. Make a File (touch)

We know how to make directories (or folders) using the mkdir command. In order to make files inside of those directories, we use touch. The following two commands show how I would make two new files, chapter_1.md and chapter_2.md:

timo@Tims-MacBook-Pro:~/latest_projects$ touch chapter_1.md
timo@Tims-MacBook-Pro:~/latest_projects$ touch chapter_2.md

We don’t see any confirmation that the file was created, but we can use ls to see what’s inside the directory:

timo@Tims-MacBook-Pro:~/latest_projects $ ls
chapter_1.md    chapter_2.md

6. Clear your terminal (clear)

Sometimes when you’ve entered a lot of terminal commands, your terimal can get pretty cluttered. You can always use clear to “clean up” your terminal workspace!

7. Remove a File (rm)

In the past, you’ve probably gotten rid of files by using the Move to trash command or dragging them into the trash, like this:

file to trash

We can remove files from the command line using the rm command, like this:

timo@Tims-MacBook-Pro:~/latest_projects $ rm chapter_1.md

Again, we don’t get a confirmation, but if I were to ls right now, nothing would appear since the directory is now empty.

timo@Tims-MacBook-Pro:~/latest_projects $ ls
chapter_2.md

Things to Note

  • A file removed using the rm command does not go into your trash where you could restore it later.
  • Although it may be possible to recover files deleted with rm, it is a difficult process requiring special tools and time. For now, assume that any file you remove using the rm command is gone for good.

9. Remove a Directory and Its Contents (rm -rf)

We can use rm to remove a file, but we use a different command when we’re removing a directory. Since a directory could potentially contain other files and directories inside of it, we use rm -rf which stands for remove recursively, or go inside this directory and remove everything inside of it as well.

In order to remove a directory, you must be OUTSIDE of that directory. For example, if I’m inside a books directory and I want to remove it, I first need to get out of it using cd .., then use the rm -rf books:

timo@Tims-MacBook-Pro:~/latest_projects/books$ cd ..
timo@Tims-MacBook-Pro:~/latest_projects$ rm -rf books

Now when I type ls, I will no longer see books listed.

Try It: Removing files (rm) and directories (rm -rf)

files and directories 2

We'll work through these exercises together.

For this scenario, assume that each question is independent of the rest, and that the starting point is always the diagram to the left.

I'm in to_do. What do I type to remove random.md?

I'm in to_do. What do I type to remove the home directory?

I'm in the work directory. What two commands do I type to remove the home directory?

I'm in the projects_to_delegate directory. What two commands do I type to remove the directory I'm currently in?

I'm in projects_to_delegate. What four commands do I need to type to remove the cleaning.md file?

Putting it All Together

At this point, we'll split into breakout rooms. The person whose name first name starts with the letter closest to T will share their screen by clicking the green "Share Screen" button. We will call this person the driver. Every other person in the room will be a navigator.

The driver will be the person typing the commands, but the navigators should be the ones who brainstorm what comes next or what to type. In addition to naming the steps, discuss why you are doing each step, or what exactly is taking place in each step.

If you are already comfortable with commands, your challenge during the breakout is somewhat more difficult: your goal is to focus on your explanations, communication, and ability to gauge whether or not another person understands you.

Demo: Driver-Navigator Format

  1. Type cd to get to your home directory (you’ll probably already be here, but do it just to be sure)
  2. Make a new directory called terminal_practice
  3. Move into that directory
  4. Print your current directory
  5. Make a file called favorite_foods.md
  6. List the contents of your directory (you should see just your favorite_foods.md file appear)
  7. Use Atom add your #1 favorite food to the file
  8. Delete the favorite_foods.md file
  9. Get back out of the terminal_practice directory
  10. Remove the terminal_practice directory

Challenge #1

For this next challenge, the person whose name is next closest to the letter T will share their screen and become the driver.

  1. Type cd to get to your home directory (you’ll probably already be here, but do it just to be sure)
  2. Make a new directory called my_first_projects
  3. Make another new directory called my_other_projects
  4. List the contents of your directory (you should see these two directories you just made in the list)
  5. Remove the my_other_projects directory
  6. Move into the my_first_projects directory
  7. Make a file called ruby.md
  8. Make a file called javascript.md
  9. Make a file called python.md
  10. List the contents of your directory (you should see the three files you just created)
  11. Delete the ruby.md file but leave the others
  12. Get back out of the my_first_projects directory
  13. List the contents of your directory (you should see my_first_projects)
  14. Remove the my_first_projects directory

Challenge #2

The person who has not yet been the driver will share their screen.

  1. Type cd to get to your home directory (you’ll probably already be here, but do it just to be sure)
  2. Make a new directory called session3_practice
  3. Move into the session3_practice directory
  4. Print the path to your current directory
  5. Make a file called terminal.md
  6. List the contents of your directory (you should see the terminal.md file you just created)
  7. Add the text “The terminal is an interface to give commands to the computer” to the terminal.md file
  8. Get back out of the session3_practice directory
  9. Remove the session3_practice directory

Googling

Believe it or not, a good chunk of your time as a programmer will be spent Googling to find answers to your questions. In fact, a somewhat experienced programmer will Google at a much higher rate than a beginning programmer. Therefore, it’s really important to get good at Googling.

For a frame of reference so that you know just how often we rely on Google (even the “easy” stuff), this is my most recent Chrome history as I’ve been building this curriculum 😂

Rachel's search history

When I Google programming questions, I usually include three things (in varying orders):

  • What I want to do (verb)
  • to what thing (noun)
  • using what language or tool

For example, if I wanted to add a thick green border to a heading on my webpage and I’m using plain CSS for styling, I might google this:

how to add border to heading css

or

make border on heading element css

SUPER IMPORTANT: You might not get the results you’re looking for on the first go-around.

Try It: Writing Google-able Phrases

Write out Google-able search phrases for each of the following scenarios. Do not get hung up on being unfamiliar with the terminology for each scenario. We just want phrases to put into Google.

1. I am using Git for version control and made a typo in a commit message. I need to change it before I push my changes to GitHub.

2. I got this error message when I ran my Ruby program and I don't know what it means or how to fix it: "unterminated string meets end of file"

Sifting Through Results

Once you formulate a good Google search and receive your results, there are a few things you’ll want to consider when determining which results to open.

Demo: Google Results

We'll look through some Google results for "how do you find out the length of a string in javascript?". Be ready to jot down tips for sifting through results.

Close Out

Key takeaways from today:

  • You should have a better understanding of the skills + mindsets necessary to succeed at Turing
  • You should understand how to navigate files/directories using your terminal
  • You should understand basic action, safe/informative, and destructive terminal commands
  • You should understand how to google programming questions

Homework

Find the homework in your Mod 0 Trello Board. Contact your instructors if you’re stuck (or better yet, post in the public slack channel as you’re likely not the only one running in to that issue)

Also, please note that the Mod 1 Prework takes about 40 hours total to complete. Part of your HW this week is to create a calendar for Mod 0 where you can plan how to spend your time on classes, HW, and the Mod 1 Prework!

If you find yourself falling behind, it is your responsibility to reach out to your TAs early!

Keyboard Shortcuts

Most computer users rely heavily on the mouse to open applications, interact with programs, etc. You might think that you’re quick with a mouse, but just wait until you get good at keyboard shortcuts.

Initially, your flow will be slower as you learn and memorize each of the shortcuts. However, if you force yourself to use these shortcuts, you’ll become MUCH faster in the long run.

Try it: Shortcuts

Mac Environment

Use these shortcuts to quickly move around within your environment.

  • Open a program or search for a file:
    command + spacebar

    Then start typing the name of the program or file to search for such as "Terminal" Or "Chrome", then press return to open that program or file

  • Cycle through open programs:
    command + tab + tab ...
  • Switch between separate open windows of the same program:
    command + `
  • Quit an Open Program:
    command + Q

Rectangle

Start by making sure Rectangle is running with (command + spacebar) then type rectangle and then return. You should see a window icon at the top right of your menu bar. Click the icon to see a dropdown of your shortcuts. Click preferences to customize them.

  • Full Screen Current Window:
    command + option + enter
  • Left Half Current Window:
    command + option + left-arrow
  • Right Half Current Window:
    command + option + right-arrow
  • Top Half Current Window:
    command + option + up-arrow
  • Bottom Half Current Window:
    command + option + down-arrow

Chrome Browser

Start by opening Chrome with the shortcut (command + space) you already learned.

  • Bookmark Page:
    command + D
  • Open New Tab:
    command + T
  • Open New Window:
    command + N
  • Open New Incognito Window:
    command + shift + N
  • Highlight Current URL:
    command + L
  • Cycle Through Tabs:
    Right: control + tab
    Left: control + shift + tab
  • Reload Page:
    command + shift + R
  • Close Tab:
    command + W

This video from Technical Programs Instructor Amy Holt gives some great screen management tips.