Linux command mkdir

Опубликовано: 14 Сентябрь 2023
на канале: Tempcoder Tech
134
4

The `mkdir` command in Linux is used to create directories (folders) within the file system. You can use it to create a new directory with a specified name in the current working directory or specify a full path to create a directory at a specific location.

Here's the basic syntax of the `mkdir` command:
mkdir [options] directory_name

Here, `directory_name` is the name of the directory you want to create.

Some common options and examples of using the `mkdir` command:

Create a directory in the current working directory:

bash
mkdir my_directory

This command will create a directory named "my_directory" in the current directory.

Create a directory with a specific path:

bash
mkdir /path/to/my_directory

This command will create a directory named "my_directory" at the specified path.

Create multiple directories at once using the `-p` option:

bash
mkdir -p /path/to/parent_directory/sub_directory

This will create both "parent_directory" and "sub_directory" if they don't exist, creating the full directory structure.

Create multiple directories with numeric mode permissions using the `-m` option:

bash
mkdir -m 755 my_directory

This command creates "my_directory" with the specified permission mode (755 in this case).

Create intermediate directories as needed with the `-p` option:

bash
mkdir -p /path/to/parent_directory/child_directory/grandchild_directory

This will create the entire directory structure if it doesn't exist, including "parent_directory," "child_directory," and "grandchild_directory."

Remember that you typically need appropriate permissions to create directories in certain locations, especially in system directories or directories owned by other users. Using the `-p` option is handy when you want to create a directory structure, as it will create intermediate directories as needed.


Смотрите видео Linux command mkdir онлайн, длительностью часов минут секунд в хорошем качестве, которое загружено на канал Tempcoder Tech 14 Сентябрь 2023. Делитесь ссылкой на видео в социальных сетях, чтобы ваши подписчики и друзья так же посмотрели это видео. Данный видеоклип посмотрели 134 раз и оно понравилось 4 посетителям.