Creating and Moving Folders in the Command Line

While moving and renaming directories is done the same as with files, creating directories is different. In this video you'll learn how to do all three.

Creating Folders with mkdir

Creating a new directory (or folder) is done using the "mkdir" command (which stands for make directory.) I'll create a new directory named "OtherStuff".

The command I'll use is this: "mkdir OtherStuff"

When I type "ls", we'll see the new folder in our list. That's really all there is to it!

Renaming Folders with mv

The "mv" command works exactly the same with directories as it does with files. For example I'll rename the directory to "OtherThings".

The command I'll use is this: "mv OtherStuff/ OtherThings"

(Remember, the "/" is automatically added when I press the Tab key to autocomplete, and doesn't affect the command. It works the same with or without the "/")

Now, we press Enter, and then when we use the "ls" command, we'll see that the file name has been changed.

Moving Folders with mv

And if I wanted to move the "OtherThings" directory down inside the "VeryImportant" directory we can do that too.

The command I'll use is this: "mv OtherThings/ VeryImportant/"

Now when we type "ls" the "OtherThings" directory is gone. However, if we type "ls VeryImportant/" (to list the files inside the "VeryImportant" directory), we'll see the "OtherThings" directory here.