mkdir cd 创建并进入文件夹,创建并进入目录,只写一遍目录名, `$_`获取最后一个参数, 笔记221108
mkdir -p /x/y/z ; cd $_
mkdir -p dirName ; cd $_
mkdir -p folderName;cd $_
创建并进入文件夹的通常方法是先创建文件夹再进入文件夹
这样的话,文件夹路径名要写两遍
例如
sudo mkdir -p ~/hello/world/ni/hao
cd ~/hello/world/ni/hao
发现一个好东东 $_
$下划线
只写一遍目录名
sudo mkdir -p ~/hello/world/ni/hao ; cd $_
也可以
sudo mkdir -p ~/hello/world/ni/hao && cd $_
$_
应该是表示最后一个参数, 下面是一个测试
Ubuntu22.04桌面版的 mkdir 命令笔记
mkdir 用于创建文件夹
mkdir -p
自动创建父文件夹,父文件夹存不存在都没关系, 等效 mkdir --parents
mkdir --help
用法:mkdir [选项]… 目录…
若指定<目录>不存在则创建目录。
必选参数对长短选项同时适用。
-m, --mode=模式 设置权限模式(类似chmod),而不是 a=rwx 减 umask
-p, --parents 需要时创建目标目录的上层目录,但即使这些目录已存在
也不当作错误处理
-v, --verbose 每次创建新目录都显示信息
-Z 设置每个创建的目录的 SELinux 安全上下文为默认类型
–context[=CTX] 类似 -Z,或如果指定了 CTX,则将 SELinux 或 SMACK 安全
上下文设置为 CTX 对应的值
–help 显示此帮助信息并退出
–version 显示版本信息并退出
用法:mkdir [选项]... 目录...
若指定<目录>不存在则创建目录。必选参数对长短选项同时适用。-m, --mode=模式 设置权限模式(类似chmod),而不是 a=rwx 减 umask-p, --parents 需要时创建目标目录的上层目录,但即使这些目录已存在也不当作错误处理-v, --verbose 每次创建新目录都显示信息-Z 设置每个创建的目录的 SELinux 安全上下文为默认类型--context[=CTX] 类似 -Z,或如果指定了 CTX,则将 SELinux 或 SMACK 安全上下文设置为 CTX 对应的值--help 显示此帮助信息并退出--version 显示版本信息并退出
man mkdir
MKDIR(1) User Commands MKDIR(1)NAMEmkdir - make directoriesSYNOPSISmkdir [OPTION]... DIRECTORY...DESCRIPTIONCreate the DIRECTORY(ies), if they do not already exist.Mandatory arguments to long options are mandatory for short options too.-m, --mode=MODEset file mode (as in chmod), not a=rwx - umask-p, --parentsno error if existing, make parent directories as needed-v, --verboseprint a message for each created directory-Z set SELinux security context of each created directory to the default type--context[=CTX]like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX--help display this help and exit--versionoutput version information and exitAUTHORWritten by David MacKenzie.REPORTING BUGSGNU coreutils online help: <https://www.gnu.org/software/coreutils/>Report any translation bugs to <https://translationproject.org/team/>COPYRIGHTCopyright © 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/li‐censes/gpl.html>.This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.SEE ALSOmkdir(2)Full documentation <https://www.gnu.org/software/coreutils/mkdir>or available locally via: info '(coreutils) mkdir invocation'GNU coreutils 8.32 February 2022 MKDIR(1)
MKDIR(1) User Commands MKDIR(1)
NAME
mkdir - make directories
SYNOPSIS
mkdir [OPTION]… DIRECTORY…
DESCRIPTION
Create the DIRECTORY(ies), if they do not already exist.
Mandatory arguments to long options are mandatory for short options too.-m, --mode=MODEset file mode (as in chmod), not a=rwx - umask-p, --parentsno error if existing, make parent directories as needed-v, --verboseprint a message for each created directory-Z set SELinux security context of each created directory to the default type--context[=CTX]like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX--help display this help and exit--versionoutput version information and exit
AUTHOR
Written by David MacKenzie.
REPORTING BUGS
GNU coreutils online help: https://www.gnu.org/software/coreutils/
Report any translation bugs to https://translationproject.org/team/
COPYRIGHT
Copyright © 2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/li‐
censes/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
SEE ALSO
mkdir(2)
Full documentation <https://www.gnu.org/software/coreutils/mkdir>or available locally via: info '(coreutils) mkdir invocation'
GNU coreutils 8.32 February 2022 MKDIR(1)
info mkdir
File: coreutils.info, Node: mkdir invocation, Next: mkfifo invocation, Prev: ln invocation, Up: Special file types12.3 ‘mkdir’: Make directories
==============================‘mkdir’ creates directories with the specified names. Synopsis:mkdir [OPTION]... NAME...‘mkdir’ creates each directory NAME in the order given. It reports
an error if NAME already exists, unless the ‘-p’ option is given and
NAME is a directory.The program accepts the following options. Also see *note Common
options::.‘-m MODE’
‘--mode=MODE’Set the file permission bits of created directories to MODE, whichuses the same syntax as in ‘chmod’ and uses ‘a=rwx’ (read, writeand execute allowed for everyone) for the point of the departure.*Note File permissions::.Normally the directory has the desired file mode bits at the momentit is created. As a GNU extension, MODE may also mention specialmode bits, but in this case there may be a temporary window duringwhich the directory exists but its special mode bits are incorrect.*Note Directory Setuid and Setgid::, for how the set-user-ID andset-group-ID bits of directories are inherited unless overridden inthis way.‘-p’
‘--parents’Make any missing parent directories for each argument, settingtheir file permission bits to the umask modified by ‘u+wx’. Ignoreexisting parent directories, and do not change their filepermission bits.To set the file permission bits of any newly-created parentdirectories to a value that includes ‘u+wx’, you can set the umaskbefore invoking ‘mkdir’. For example, if the shell command ‘(umasku=rwx,go=rx; mkdir -p P/Q)’ creates the parent ‘P’ it sets theparent’s permission bits to ‘u=rwx,go=rx’. To set a parent’sspecial mode bits as well, you can invoke ‘chmod’ after ‘mkdir’.*Note Directory Setuid and Setgid::, for how the set-user-ID andset-group-ID bits of newly-created parent directories areinherited.‘-v’
‘--verbose’Print a message for each created directory. This is most usefulwith ‘--parents’.‘-Z’
‘--context[=CONTEXT]’Without a specified CONTEXT, adjust the SELinux security contextaccording to the system default type for destination files,similarly to the ‘restorecon’ command. The long form of thisoption with a specific context specified, will set the context fornewly created files only. With a specified context, if bothSELinux and SMACK are disabled, a warning is issued.An exit status of zero indicates success, and a nonzero value
indicates failure.
File: coreutils.info, Node: mkdir invocation, Next: mkfifo invocation, Prev: ln invocation, Up: Special file types
12.3 ‘mkdir’: Make directories
‘mkdir’ creates directories with the specified names. Synopsis:
mkdir [OPTION]... NAME...
‘mkdir’ creates each directory NAME in the order given. It reports
an error if NAME already exists, unless the ‘-p’ option is given and
NAME is a directory.
The program accepts the following options. Also see *note Common
options::.
‘-m MODE’
‘–mode=MODE’
Set the file permission bits of created directories to MODE, which
uses the same syntax as in ‘chmod’ and uses ‘a=rwx’ (read, write
and execute allowed for everyone) for the point of the departure.
*Note File permissions::.
Normally the directory has the desired file mode bits at the momentit is created. As a GNU extension, MODE may also mention specialmode bits, but in this case there may be a temporary window duringwhich the directory exists but its special mode bits are incorrect.*Note Directory Setuid and Setgid::, for how the set-user-ID andset-group-ID bits of directories are inherited unless overridden inthis way.
‘-p’
‘–parents’
Make any missing parent directories for each argument, setting
their file permission bits to the umask modified by ‘u+wx’. Ignore
existing parent directories, and do not change their file
permission bits.
To set the file permission bits of any newly-created parentdirectories to a value that includes ‘u+wx’, you can set the umaskbefore invoking ‘mkdir’. For example, if the shell command ‘(umasku=rwx,go=rx; mkdir -p P/Q)’ creates the parent ‘P’ it sets theparent’s permission bits to ‘u=rwx,go=rx’. To set a parent’sspecial mode bits as well, you can invoke ‘chmod’ after ‘mkdir’.*Note Directory Setuid and Setgid::, for how the set-user-ID andset-group-ID bits of newly-created parent directories areinherited.
‘-v’
‘–verbose’
Print a message for each created directory. This is most useful
with ‘–parents’.
‘-Z’
‘–context[=CONTEXT]’
Without a specified CONTEXT, adjust the SELinux security context
according to the system default type for destination files,
similarly to the ‘restorecon’ command. The long form of this
option with a specific context specified, will set the context for
newly created files only. With a specified context, if both
SELinux and SMACK are disabled, a warning is issued.
An exit status of zero indicates success, and a nonzero value
indicates failure.
mkdir cd 创建并进入文件夹,创建并进入目录,只写一遍目录名, `$_`获取最后一个参数, 笔记221108相关推荐
- Linux 创建、删除文件夹
Linux 创建.删除文件夹 创建文件夹 创建aa文件夹,查看列表:可以看到已经有文件夹aa; mkdir aa 批量创建文件夹(bb cc dd),查看列表:可以看到有文件夹多了三个(bb cc d ...
- 创建临时文件及文件夹
创建临时文件及文件夹 创建临时文件存储数据 1.临时文件的读取以光标为准 2.光标后存在内容,会进行文本覆盖 3.临时文件销毁后不能再进行二次读写 创建临时文件夹 创建临时文件存储数据 在临时文件进行 ...
- Linux中用mkdir同时创建多个文件夹
Linux中用mkdir同时创建多个文件夹 文章目录: 一.mkdir同时创建多个同级目录 二.mkdir同时创建多个递归目录 一.mkdir同时创建多个同级目录 命令:mkdir test1 tes ...
- Mac,Linux中用mkdir同时创建多个文件夹
Mac,Linux中用mkdir同时创建多个文件夹 前言 一.mkdir同时创建多个同级目录 1. mkdir 文件名(多个): 2. 用TXT文件导入 二.mkdir同时创建多个递归目录 前言 提示 ...
- 批量创建10个文件夹,只需1秒~
* 也许有时候你也在烦恼,一个一个创建文件夹,好累呀!今天教你一个简单的方法,用一行命令就可以做到 ls 进入电脑根目录 cd Movies 进入Movies文件夹 输入创建文件夹命令 mkdir 长 ...
- 计算机用户的创建文件夹,在Windows中如何使用cmd创建多个文件夹
没有很多Windows用户都熟悉的CMD. 常见的误解是,只有程序员和计算机爱好者使用CMD. 基本上,CMD是一个工具,你可以使用与Windows计算机进行通信.下面就让学习啦小编教大家在Windo ...
- android 创建隐藏文件夹吗,Android创建隐藏文件可能文件夹
Android创建隐藏文件或者文件夹 android创建隐藏文件或者文件夹,其实只要在文件名或者文件夹名字前加一个点号即可. 隐藏文件(夹)可直接进行读写. 如果需要去除隐藏,那就是重命名,去除点即可 ...
- python创建多个文件_Python创建文件夹与文件的快捷方法
这篇文章主要给大家介绍了关于Python创建文件夹与文件的快捷方法以及批量创建文件夹的方法,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学 ...
- 转:飝兒物語的“Linux创建、删除文件夹”
原创地址: http://www.cnblogs.com/zf2011/archive/2011/05/17/2049155.html 创建文件夹[mkdir] 一.mkdir命令使用权限 所有用户都 ...
最新文章
- Hibernate 入门小案例
- Java黑皮书课后题第3章:**3.24(游戏:抽牌)编写程序,模拟从一副52张的牌中抽一张牌,程序应显示牌的大小、花色
- phpcms漏洞总结
- c#中的23种设计模式
- 你和985硕博研究生,差了这些东西
- 【HDU - 5890】Eighty seven(bitset优化背包)
- linux查看openssh和openssl版本命令
- 史上最全的延迟任务实现方式汇总!附代码(强烈推荐)
- 程序一旦发觉写得不理想,那就得重构它
- 对工作生活的一点感悟
- Spring学习总结(23)——Spring Framework 5.0 新特性
- select 的操作
- 7-31 查验身份证 (15 分)
- [CF321E] Ciel and Gondolas
- 我用Anylogic写了一个遗传算法
- Axure下载安装-汉化-注册码
- 计算机删除内置用户,如何删除windows的内置账户,administrator
- 计算机科学 杂志 撤稿,哈佛教授2篇顶刊遭撤稿:相同样品花样“复用”,伪装成不同实验结果...
- 如何写互联网产品分析报告
- Python list 列表方法