cmd line tutorials - gencmd

cmd line tutorials - gencmd

The mkdir Command

Unix-Linux Mac

The mkdir command is used to create directories.

Syntax

The basic syntax for the mkdir command is as follows:

mkdir [options] <directory_name>

The <directory_name> argument is the name of the directory that you want to create. The [options] argument is a list of options that can be used to modify the behavior of the mkdir command.

Examples

Create a directory named my_directory in the current directory.

mkdir my_directory

Create a directory named my_project in the /home/user directory.

mkdir /home/user/my_project

Create all directories in this path if it does not already exist.

mkdir -p /tmp/dir1/dir2

For more information on the mkdir command and its options, please see the man page: man mkdir.

With gencmd

gencmd create a new directory in user root

  • mkdir ~/newdir
  • mkdir -p ~/dir/new_directory