Creating a Directory Structure in Linux

30 minutes
  • 4 Learning Objectives

About this Hands-on Lab

A Linux system administrator needs to know how to create files and folders on a computer. This exercise will assist you in creating a new directory structure, and adding new files to this structure.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create the ‘Projects’ Parent Directories

Create the first parent directory structure with the mkdir command, and use the -p switch:

mkdir -p Projects/ancient
mkdir Projects/classical
mkdir Projects/medieval


mkdir -p Projects/{ancient,classical,medieval}
Create the ‘Projects’ Subdirectories

Create the subdirectory structure:

mkdir Projects/ancient/egyptian
mkdir Projects/ancient/nubian
mkdir Projects/classical/greek
mkdir Projects/medieval/britain
mkdir Projects/medieval/japan


mkdir Projects/ancient/{egyptian,nubian}
mkdir Projects/classical/greek
mkdir Projects/medieval/{britain,japan}
Create ‘Projects’ Empty Files for Next Step

Create the empty files for later use:

touch Projects/ancient/nubian/further_research.txt
touch Projects/classical/greek/further_research.txt
Rename a ‘Projects’ Subdirectory

The user would like for the classical directory to be renamed to greco-roman.

mv Projects/classical Projects/greco-roman

Additional Resources

You are responsible for handing a workstation with a specified directory structure to a new user. This user is a historian and will need to keep notes on various research topics separated into eras of time. Within the user's home directory, a new folder called 'Projects' needs to exist with the following subfolders: ancient, classical, and medieval. Under the ancient directory, two more directories must exist: egyptian and nubian. Within the classical directory, a folder named greek must exist. Within the medieval directory, two more directories need to be created: britain and japan.

A new, empty file named further_research.txt should be in the nubian and greek directories.

At the last moment, the classical directory needs to be renamed to greco-roman

Once these tasks are done, hand the system over to your team member for verification.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?