Difference between revisions of "Mkdir"
Jump to navigation
Jump to search
(5 intermediate revisions by 2 users not shown) | |||
Line 9: | Line 9: | ||
* <code>mkdir ~/[[.ssh]]</code> | * <code>mkdir ~/[[.ssh]]</code> | ||
* <code>mkdir -p "$([[dirname]] "$1")" && [[touch]] "$1"</code> | * <code>mkdir -p "$([[dirname]] "$1")" && [[touch]] "$1"</code> | ||
+ | * <code>[[mkdir -p]] /your_path/{dir1,dir2}</code> | ||
mkdir -p /path/to/your/new/dir | mkdir -p /path/to/your/new/dir | ||
mkdir: cannot create directory ‘/path’: [[Read-only file system]] | mkdir: cannot create directory ‘/path’: [[Read-only file system]] | ||
+ | |||
+ | mkdir /tmp | ||
+ | mkdir: cannot create directory ‘/tmp’: File exists | ||
+ | |||
+ | mkdir -p /tmp | ||
+ | (no output) | ||
===Options=== | ===Options=== | ||
− | *<code>-p, --parents makes parents directories if needed</code> | + | *<code>-p, --parents makes parents directories if needed and [[exit|no error if existing]]</code> |
== Related commands == | == Related commands == | ||
Line 23: | Line 30: | ||
* <code>[[aws s3 mb]]</code> | * <code>[[aws s3 mb]]</code> | ||
* <code>[[touch]]</code> | * <code>[[touch]]</code> | ||
+ | * <code>[[mkcd]]</code> [[omz]] | ||
== See also == | == See also == |
Latest revision as of 19:25, 28 May 2023
wikipedia:mkdir command to create directories.
-p, --parents
Examples[edit]
mkdir -p /path/to/your/new/dir
mkdir ~/.ssh
mkdir -p "$(dirname "$1")" && touch "$1"
mkdir -p /your_path/{dir1,dir2}
mkdir -p /path/to/your/new/dir mkdir: cannot create directory ‘/path’: Read-only file system
mkdir /tmp mkdir: cannot create directory ‘/tmp’: File exists
mkdir -p /tmp (no output)
Options[edit]
-p, --parents makes parents directories if needed and no error if existing
Related commands[edit]
See also[edit]
Advertising: