Chapter 4
Make A Directory (mkdir)

4.1 Do This


Source 5: Linux/Mac OSX Exercise 4
  $ mkdir temp
  $ mkdir temp/stuff
  $ mkdir temp/stuff/things
  $ mkdir -p temp/stuff/things/frank/joe/alex/john
  $


Source 6: Windows Exercise 4
  > mkdir temp
  
  
      Directory: C:\Users\zed
  
  
  Mode                LastWriteTime     Length Name
  ----                -------------     ------ ----
  d----        12/17/2011   9:02 AM            temp
  
  
  > mkdir temp/stuff
  
  
      Directory: C:\Users\zed\temp
  
  
  Mode                LastWriteTime     Length Name
  ----                -------------     ------ ----
  d----        12/17/2011   9:02 AM            stuff
  
  
  > mkdir temp/stuff/things
  
  
      Directory: C:\Users\zed\temp\stuff
  
  Mode                LastWriteTime     Length Name
  ----                -------------     ------ ----
  d----        12/17/2011   9:03 AM            things
  
  
  > mkdir temp/stuff/things/frank/joe/alex/john
  
  
      Directory: C:\Users\zed\temp\stuff\things\frank\joe\alex
  
  
  Mode                LastWriteTime     Length Name
  ----                -------------     ------ ----
  d----        12/17/2011   9:03 AM            john
  
  
  >

4.2 You Learned This

Now we get into typing more than one command. These are all the different ways you can run mkdir. What's mkdir do? It make directories. Why are you asking that? You should be doing your index cards and getting your commands memorized. If you don't know that "mkdir makes directories" then keep working the index cards.

What does it mean to make a directory? You might call directories "folders." They're the same thing. All you did above is create directories inside directories inside of more directories. This is called a "path" and it's a way of saying "first temp, then stuff, then things and that's where I want it." It's a set of directions to the computer of where you want to put something in the tree of folders (directories) that make up your computer's hard disk.


Note 3: Windows, Slashes And Backslashes

In this book I'm using the / (slash) character for all paths since they work the same on all computers now. However, Windows users will need to know that you can also use the \ (backslash) characters and other Windows users will typically expect those at times.


4.3 Do More

  1. The concept of a "path" might confuse you at this point. Don't worry. We'll do a lot more with them and then you'll get it.
  2. Make 20 other directories inside the temp directory in various levels. Go look at them with a graphical file browser.
  3. Make a directory with a space in the name by putting quotes around it: mkdir "I Have Fun"
  4. If the temp directory already exists then you'll get an error. Use cd to change to a work directory that you can control and try it there. On windows Desktop is a good place.


Online Video Course + PDF For $9

For the price of most other course's PDFs only, you can get the full PDF for this class and 2 videos demonstrating the whole book for both Unix/OSX Terminal and Windows PowerShell. The course is self-paced so you can go through it any time you want, as many times as you want.


Signup Now At Udemy.com For $9