Linux Hands-On Lab - Creating a Directory Structure in Linux

Linux Hands-On Lab - Creating a Directory Structure in Linux

Linux Learning Path for Cloud and DevOps Engineers

📝Introduction

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

📝Log in to the AWS Management Console

Using your credentials, make sure you're using the right Region. In my case, I am using AWS as my cloud provider and chose us-east-1. However, you can choose any cloud provider and create your Linux Server VM (I am using a CentOS 7 distro) for this hands-on lab.

📌Note: You must create the AWS Access Key and AWS Secret Access Key and configure the AWS CLI in the terminal to use it.

You can use link1 and link2 for it.

📝Create the directory structure with Hand or Bash expansion commands

By Hand:

mkdir -p Projects/test1
mkdir Projects/test2
mkdir Projects/test3

By Bash expansion:

It's much less typing. This command makes all three directories in one pass:

mkdir -p Projects/{test1,test2,test3}

📝Create the Subdirectories structure with Hand or Bash expansion commands

By Hand:

mkdir Projects/test1/test1.1
mkdir Projects/test2/test2.1
mkdir Projects/test3/test3.1

By Bash expansion:

mkdir Projects/test1/{test1.1,1.2}
mkdir Projects/test3/{test3.1,3.2}
OR
mkdir Projects/test2/test2.1

📝Create Some Empty Files

To create a couple of empty text files we'll do it with the touch command:

touch Projects/test1/test1.1/test1.txt
touch Projects/test3/3.2/test3.txt

📝Rename a Subdirectory

We can do that easily with the mv command:

mv Projects/test1/1.2 Projects/test1/test1.2

📌Note - At the end of each hands-on Lab, always clean up all the resources previously created to avoid being charged if you used a Cloud Provider to provision them.

Congratulations — you have completed this hands-on lab covering the basics of creating files and folders on a Linux computer.

Thank you for reading. I hope you understood and learned something helpful from my blog.

Please follow me on CloudDevOpsToLearn and LinkedIn, franciscojblsouza