加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

unix – mkdir的“-p”选项

发布时间:2020-12-15 19:16:00 所属栏目:安全 来源:网络整理
导读:所以这似乎不是一个非常复杂的问题,但是我也找不到答案。我只是混淆了在Unix中的-p选项。我在创建一个子目录,然后再创建另一个子目录时,将其用于实验室分配。看起来像这样: mkdir -p cmps012m/lab1 这是一个具有正常权限的私有目录(rlidwka)。提前致谢!
所以这似乎不是一个非常复杂的问题,但是我也找不到答案。我只是混淆了在Unix中的-p选项。我在创建一个子目录,然后再创建另一个子目录时,将其用于实验室分配。看起来像这样:
mkdir -p cmps012m/lab1

这是一个具有正常权限的私有目录(rlidwka)。提前致谢!呵呵,有人会想出一点点解释“rlidwka”的意思吗?我不是Unix的总数,但我不太熟悉这是什么意思。希望这不是一个问题的含糊不清。

手册页是您可以找到的最好的信息源…并且在您的指尖:man mkdir产生关于-p开关:
-p,--parents
    no error if existing,make parent directories as needed

用例示例:假设我要创建目录hello / goodbye但不存在:

$mkdir hello/goodbye
mkdir:cannot create directory 'hello/goodbye': No such file or directory
$mkdir -p hello/goodbye
$

-p同时创建,你好和再见

这意味着该命令将创建所有必需的目录来满足您的请求,如果该目录存在,则不返回任何错误。

关于rlidwka,Google对缩写词有非常好的记忆:)。我的搜索返回,例如:http://www.cs.cmu.edu/~help/afs/afs_acls.html

Directory permissions

l (lookup)
    Allows one to list the contents of a directory. It does not allow the reading of files. 
i (insert)
    Allows one to create new files in a directory or copy new files to a directory. 
d (delete)
    Allows one to remove files and sub-directories from a directory. 
a (administer)
    Allows one to change a directory's ACL. The owner of a directory can always change the ACL of a directory that s/he owns,along with the ACLs of any subdirectories in that directory. 

File permissions

r (read)
    Allows one to read the contents of file in the directory. 
w (write)
    Allows one to modify the contents of files in a directory and use chmod on them. 
k (lock)
    Allows programs to lock files in a directory.

因此,rlidwka意味着:所有权限。

值得一提的是,作为@KeithThompson在评论中指出,并不是所有的Unix系统都支持ACL。所以rididwka概念可能不适用于此。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读