深度阅读

How to Make Directories with mkdir Command and Set Permissions on Linux

作者
作者
2023年08月22日
更新时间
11.09 分钟
阅读时间
0
阅读量

Directories are used to store other directories or files in Linux. We can use the mkdir command to make a directory.

How to Make Directory with mkdir Command

We can use the mkdir command to make a directory. The directory name is given to the commanddir as a parameter.

$ mkdir database

How to Make Multiple Directories

We can make multiple directories using the mkdir command. Every directory name is provided as a parameter. The directory names are separated by spaces.

$ mkdir database users backups

If the directory names contain spaces double quotes .

$ mkdir "my database" "my users" "our backups"

How to Make Parent and Child Directories

We can make multi-level directories or parent-child directories with the mkdir command .

$ mkdir -p database/mysql/current/

How to Make a Directory and Set Permissions

The -m option is used to specify permissions.

$ mkdir -m 722 backup

博客作者

热爱技术,乐于分享,持续学习。专注于Web开发、系统架构设计和人工智能领域。