←
Command Line
/
Guided Lab Make Directories with mkdir
60:00
Click the virtual machine below to start practicing
>_ Tekhnikum | Lab
- Setting up virtual machine…
- Preparing lab files…
- Starting terminal services…
This lab machine has stopped
Your progress through the guide is saved. Start a fresh machine to keep practicing.
Introduction
mkdir (make directory) creates directories. You'll build a small library tree in ~/project.
This lab is the hands-on companion to the mkdir (Make Directory) lesson from Linux Journey (CC BY-SA 4.0).
One Directory
mkdir documents
ls -l
Several at Once
mkdir books paintings
A Whole Path with -p
Without help, mkdir refuses to create a directory whose parent doesn't exist. -p (parents) creates every missing level:
mkdir -p books/hemingway/favorites
ls -R books
Set Permissions on Creation
-m sets the permissions as the directory is made. 700 means only you can enter it:
mkdir -m 700 private
ls -ld private
drwx------ 2 learner learner 4096 Oct 18 10:02 private
Summary
mkdir name creates a directory; list several names to make several.
-p creates any missing parent directories.
-m sets permissions as the directory is created.