适用于Linux和Windows的mkdir命令选项

mkdir command is used to create new folders and directories. mkdir have very little options but because of the mkdir command importance, we will examine these options.

mkdir命令用于创建新的文件夹和目录。 mkdir选项很少,但是由于mkdir命令的重要性,我们将研究这些选项。

Linux选项 (Linux Options)

There are more Linux options than Windows operating systems option. We will look these Linux options below.

Linux选项比Windows操作系统选项更多。 我们将在下面查看这些Linux选项。

帮助选项 (Help Option)

We can print help information about the mkdir command options. We will use --help  in order to print help information about options.

我们可以打印有关mkdir命令选项的帮助信息。 我们将使用--help来打印有关选项的帮助信息。

$ mkdir --help
Help Option
Help Option
帮助选项

设置文件夹和目录模式(Set Folders and Directories Mode)

We can use -m or --mode option in order to set permissions about folders and directories which will be created with the mkdir command. In this example, we will set rwx.

我们可以使用-m--mode选项来设置有关将使用mkdir命令创建的文件夹和目录的权限。 在此示例中,我们将设置rwx

$ mkdir -m a=rwx test

父选项 (Parent Option)

While creating folders and directories in a recursive fashion, if the parent is not currently existed we will get an error like cannot create directory ‘ismaail/baydan/backup’: No such file or directory. Because there is o directory like ismail and baydan . We can create with a single command multiple child and parent directories by using -p option. In this example, ismail and baydan will be created automatically and then backup directory will be created without a problem.

当以递归方式创建文件夹和目录时,如果当前不存在父目录,我们将收到类似cannot create directory 'ismaail/baydan/backup': No such file or directory 。 因为有像ismailbaydan这样的目录。 我们可以使用-p选项通过一个命令创建多个子目录和父目录。 在此示例中,将自动创建ismailbaydan ,然后将创建backup目录而不会出现问题。

$ mkdir -p ismail/baydan/backup

详细选项 (Verbose Option)

During folder and directory creation there will be no information about process except errors. We can print operations about folder and directory creation with the -v option like below.

在创建文件夹和目录的过程中,除了错误之外,没有其他有关进程的信息。 我们可以使用-v选项打印有关文件夹和目录创建的操作,如下所示。

$ mkdir -p ismail/baydan/backup
Verbose Option
Verbose Option
详细选项

SELinux选项(SELinux Option)

SELinux is a security mechanism used to protect files and folders access via processes. We can set SELinux context by using --context option.

SELinux是一种安全机制,用于保护通过进程的文件和文件夹访问。 我们可以使用--context选项设置SELinux上下文。

Windows选项 (Windows Options)

Windows operating system provides less option than Linux counterpart. We can only print usage information with the help information.

Windows操作系统提供的选择少于Linux操作系统。 我们只能打印使用信息和帮助信息。

帮助选项 (Help Option)

We can print help information with the /? option like below.

我们可以使用/?打印帮助信息/? 如下所示的选项。

> mkdir /?
Windows Help Option
Windows Help Option
Windows帮助选项
LEARN MORE  Linux umask Command Tutorial with Examples, Numeric and Symbolic Representations
了解更多Linux umask命令教程,包括示例,数字和符号表示

翻译自: https://www.poftut.com/mkdir-command-options-for-linux-and-windows/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值