Learn to use the Command Prompt application to navigate Windows from the command line.
- [Instructor] As developers, we're going to need to work with the command line, the part of Windows that's behind the graphical user interface that you usually use. To do that, we'll need to use a command line application called Command Prompt. I'll demonstrate using Windows 10. You want to go to the Windows Start menu, and from here you can choose All Apps. Once you choose All Apps, you should get a list of all the apps on your system. You want to scroll down to the very bottom of the list and you want to look for Windows System.
You click on Windows System, it will open up and you'll see a choice here at the very top for Command Prompt, right here. We're going to open Command Prompt up and that'll launch the program for us. Now if you're using an older version of Windows, it was often stored in the Accessories directory. You might look under All Applications, and then inside, Accessories, in order to find the Command Prompt. But the program still works the same. Now we're looking at a text-based view of our hard drive. We can navigate and work with items using commands instead of by clicking and dragging using our mouse.
Notice that the Command Prompt begins with our current location. We've got C:/Users/Kevin Skoglund. That's the location that I'm in. That's my User directory. Now in order to see the contents of the current directory I'm in, I can type D-I-R and hit Return. This will tell me the listing of all the items inside the directory. Now you should note that on the Mac and Unix side of things, this command is called L-F, or sometimes they might call it L-F dash L-A. So if you hear me say L-F on the Mac side of things, then you should think D-I-R.
That's how we get the directory listing in the command prompt. We can move around by using another command which is C-D. C-D for change directory. And then we tell it what directory we want to go into. So I'm going to go in the Favorites directory that you see in the listing up there. I'm going to do that by typing a space, and then I'm going to start typing F-A-V-O. Now I could keep typing the whole thing, but I also want to show you that if you hit the Tab key, it will auto-complete that name for you and save you some typing. That's kind of a nice feature. It helps you to make sure you avoid some spelling mistakes, as well.
Once I hit Return, it will navigate into that directory, and you can see that the prompt changes to show you the new location. I'll type D-I-R again to see the contents of this directory, and there's another directory in there called Links. We're going to go to that in just a moment. For now I want to go backward a directory. Let's go back to our User directory. We can do that with C-D, space, dot dot. Dot dot is the shortcut for the parent directory. It says go up one level. So now I've gone out of the Favorites directory back in the User directory that I started in.
Now let's try going in two directories deep. We're going to do C-D, space, I'll start typing Favorites. I'll hit my Tab key to auto-complete it. And now let's type a back slash, followed by L-I-N-K, and again I'll hit my Tab to auto-complete it to get Links, C-D, Favorites, Links. I'm going into two directories. I'm moving into the Favorites directory, and then also into the Links directory, all in one step. You can see that the path updated to show me where it is now. If I want to go backwards two directories, I can do the same thing.
C-D, space, dot, dot, and then that backslash, dot, dot. Going back two directories, go back one, and then go back another one. And I'm back in my User directory again. Those are the basics for how you get around. The one last trick I want to show you is that if you do want to clear your screen at any point, sometimes I like to do that, just to get that old stuff out of my way. You can type C-L-S, and that will clear screen. C-L-S and hit Return, and all of the old data will disappear from your command prompt, and it will be as if you're starting fresh. So that sums up the basics of how to move around and work with the command line.
We're going to be using the command line to install software and also to interact with Ruby on Rails. You're going to want to become familiar with it, because it is going to be one of your developer tools.