In this first text lecture of the "Rails - Windows installation" series we will cover some basic commands with which you can navigate around and use a PowerShell window.

We will use PowerShell instead of the command line since the commands are similar to the ones used in Linux and MacOS rather than being windows specific (as is the case with the regular command line).

Open PowerShell window:

Go to your search menu and start typing in PowerShell and the Windows PowerShell app will show up, click on it to open it.

1.

2.

Once opened, you will be in a prompt in your home directory. It might look something like below (figure 3), although the name will be different.

3.

From this prompt you will be able to issue commands and navigate through your computer's directory structure as you need.

In fact, this home directory is showing the same directory as your file explorer if you open it up to 'This PC'.

4.

Commands:

pwd

The first command we will learn is 'pwd' which stands for print working directory. It shows the path that you are in. If you type in pwd and hit enter, you will get the path displayed on the screen like below:

5.

As you can see above, the path for me is showing as C:\Users\mashr

ls

To get a listing of the folders (directories) and files in the current directory you are in (or path you are in), you can type in ls (which stands for list) followed by enter. You are likely to get an output like below:

6.

As you can see, files listed above using the ls command, match the directories that are listed in the windows file explorer under the 'This PC' folder.

cd

To navigate into a directory that is listed among the directories under the current directory (any listed on the screen once you ran the ls command above), you can use the cd command. For example, if you wanted to navigate to the Desktop folder, you can use the following command followed by enter:

cd Desktop

This would be the same place as if you had clicked on the Desktop folder in your windows file explorer. The output would look something like below.

7.

Notice how the path in the PowerShell prompt has changed and now ends in Desktop> since we're now in the Desktop folder and no longer in the mashr folder.

mkdir

To create a new directory/folder from the directory you are in, you can use the mkdir command. For example, if you wanted to create a test_projects_1 directory from the Desktop folder, you would type in:

mkdir test_projects_1

followed by enter.

This would create the test_projects_1 folder for you under the Desktop folder. You can also check this in your windows file explorer (from the Desktop folder).

8.

This folder will be empty once created. You can check it from the PowerShell prompt using the ls command and also from the file explorer like below. First you would need to navigate into the folder using the cd command. (The sequence of commands are shown)

9.

To move up one directory from the existing directory into it's parent directory, you can use the cd .. command. For example, if you wanted to move up to the Desktop directory from the test_projects_1 directory which you are in, you would issue the command below followed by an enter.

cd ..

10.

As you can see above, we're back to the Desktop folder.

rmdir

To delete a directory that is listed under the directories you are in, you can use the rmdir command. For example, if you wanted to delete the test_projects_1 directory that you just created from the Desktop folder, you can use the following command followed by enter.

rmdir test_projects_1

The output would look like below.

11.

Notice that the test_projects_1 directory/folder is no longer present.

If the directory was not empty, that is if it had other files or folders within it, then the PowerShell prompt would ask you to confirm if you wanted to remove the directory since removing it would erase all the files and folders contained within it as well. It would look something like below:

12.

If you choose Y here and hit enter, that will complete the removal of the folder with all it's content.

While there is a lot more to learn about the Windows PowerShell or the command line in general, we have covered enough of the basics in this text lecture to get started navigating files and folders using it at this time. Good luck!