| by Arround The Web | No comments

How To Create a Directory in Linux

Directories, or folders, are organizational structures that help you organize your data and keep your Linux systems clean. They also streamline collaboration with other users on the same system.

Hence, directories become the most essential yet basic aspect for managing your systems efficiently. Creating and removing directories is a core operation, even for system administrators. However, many Linux newbies don’t know how to create new directories correctly. So, this quick tutorial explains the simple ways to create a directory in Linux. You can easily create the directories through the mkdir and File Manager. Let’s briefly take a look at both methods with suitable examples.

The mkdir Command

The sole operation of the mkdir is to create a directory, and you can use it by running the following command:

mkdir <options> directory_name

For instance, let’s create the media directory:

mkdir media

mkdir-media-command

As you run the above command, it’ll create the media directory, and you can verify it using the ls command:

ls

In case you want to print the output of the command, then you can use the -v option:

Mkdir -v linux

v-option-in-mkdir

Moreover, if you want to create multiple directories, then all you need to do is add the name of those directories in the mkdir command:

mkdir -v windows android mac

v-option-in-mkdir-to-create-multiple-directories

You can also make a nested directory by using the -p option with the mkdir command:

mkdir -p parent_directory/sub_directory

Please replace parent_directory and sub_directory accordingly before running the command. So, let’s create the nested directory by including multiple files as the subdirectories:

mkdir -p Linux_OS/Ubuntu/Files

You can also verify the directory using the tree command:

cd ~/Linux_OS
tree

cd-command-to-check-directories

The File Manager

Apart from using the terminal, you can opt fjyh  or the File Manager to create a directory in Linux. Linux distros come with an inbuilt file manager like Nautilus. For this method, go through the following steps:

File-Manager-UI

Open the File Manager and navigate to the path where you want to create the new directory.

drop-down-menu-in-file-manager

Now, right-click and then select “New Folder” from the Options menu. In some cases, the option may show as “Create Folder.”

name-the-new-folder-in-file-manager-in-linux

Finally, enter your directory’s name and press Enter.

Wrapping Up

Creating directories in Linux is the most basic task, but many beginners still need to learn how to create one. This quick tutorial focussed on providing a step-by-step method for creating a directory using the mkdir command and the File Manager. We’d recommend using the mkdir command to build familiarity with the terminal.

Share Button

Source: linuxhint.com

Leave a Reply