/

Linux commands: mkdir

Linux commands: mkdir

In this article, we will explore the mkdir command in Linux, which is used to create folders. We will also learn about some of the options available with this command.

To create a folder, simply use the following syntax:

1
mkdir folder_name

For example, to create a folder named “fruits”, you can run the command:

1
mkdir fruits

You can create multiple folders in a single command by specifying their names separated by spaces. For instance:

1
mkdir dogs cars

This will create two folders named “dogs” and “cars” simultaneously.

The mkdir command also allows you to create nested folders. To do this, use the -p option followed by the desired folder structure. For example:

1
mkdir -p fruits/apples

This command will create the “fruits” folder if it does not already exist, followed by the “apples” folder inside it. The -p option ensures that any missing parent directories are also created.

When working with UNIX commands, it is common for options to be used to modify the behavior of the command. These options are added after the command name. In many cases, you can combine multiple options to achieve the desired result.

If you want to explore the available options for the mkdir command, you can use the man command followed by the command name. For instance, you can type man mkdir to access the manual page for mkdir. Press the q key to exit the manual page.

The manual pages, or man pages, provide comprehensive documentation and serve as a helpful resource for understanding UNIX commands.

Remember to practice and experiment with the mkdir command to become more familiar with its functionality.

tags: [“Linux commands”, “mkdir”, “folder creation”, “nested folders”, “UNIX commands”]