How to Create and Display File Structure on Linux

How to Create and Display File Structure on Linux

In this blog post, we will learn about Linux file system hierarchy concepts. Files and Directories are organized into a single-rooted inverted tree structure. The filesystem begin at the "root" directory, represented by a lone "/" (forward slash) character. Names are case-sensitive and paths are delimited by a "/".

Syntax:

mkdir <directory name>
cd <directory name>

Example:

Let us try to create a file system structure as shown in the following format:

.
└── India
    └── Karnataka
        └── Bangaluru
            └── South-Bangaluruu

Follow the below commands to create such file/directory structure:

% mkdir Asia
% cd asia
% mkdir India
% cd India
% mkdir Karnataka
% cd Karnataka
% mkdir Bangaluru
% cd Bangaluru
% mkdir South-Bangaluruu



% cd ../../..

Output:

% tree
.
└── India
    └── Karnataka
        └── Bangaluru
            └── South-Bangaluruu

4 directories, 0 files